Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update types to reflect baseUrl changes #815

Merged
merged 4 commits into from
Mar 16, 2018
Merged

Conversation

tcbyrd
Copy link

@tcbyrd tcbyrd commented Mar 15, 2018

@gr2m @philschatz I think this is the change you need to the type definitions to reflect the deprecations in https://github.com/octokit/rest.js/pull/807

See https://github.com/octokit/rest.js/pull/732#issuecomment-373554225 for more context on where I ran into this.

@philschatz
Copy link

@tcbyrd Yes that should fix it. #803 added a test/typescript-validate.ts to help catch changes that would require a change in the TypeScript definition.

It might be helpful to include all of the optional arguments to the constructor so that they are updated in the TypeScript definition when they are updated in the JavaScript.

host?: string;
pathPrefix?: string;
protocol?: string;
port?: number;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would leave these, they are deprecated but still supported. That way we don’t break existing code.

Is there a way to mark something as "deprecated" in Typescript?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think one way is to decorate it with @deprecated so that you get the message from the language server. Not sure if this causes a warning in the build.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind if I update your PR? I’ve extended the typescript test to make it less likely that I break it again :(

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be my guest!

Copy link
Author

@tcbyrd tcbyrd Mar 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSDoc doesn't cause a build failure, but it does do this:

image

when you do this:

/**
  * @deprecated in version 15.2.0
  */
host?: string;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t use JS doc in this repo, is this an editor plugin?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this an editor plugin?

It's part of the VS Code / Atom language server for TypeScript

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay thanks, I added them to each deprecated option

@gr2m
Copy link
Contributor

gr2m commented Mar 16, 2018

Does the PR look good to you now @philschatz @tcbyrd

Btw if you have an app depending on @octokit/rest that is using Typescript that you’d like me to test with before doing releases, I’d be happy to add it to my local test setup that I usually test against when working on fixes / features before releasing

@tcbyrd
Copy link
Author

tcbyrd commented Mar 16, 2018

@gr2m I think once if we finally get Probot switched over, that could be a great way to test. The compiler should help catch things like this.

@tcbyrd
Copy link
Author

tcbyrd commented Mar 16, 2018

Does the PR look good to you now @philschatz @tcbyrd

Unless @philschatz has any other suggestions on deprecations, I'd say it's good to 🚢

@philschatz
Copy link

philschatz commented Mar 16, 2018

Yep, the JSDoc comment is the only way I know of to add deprecation notices to TypeScript files. 👍 for merging.

@gr2m gr2m merged commit 7835bde into octokit:master Mar 16, 2018
@octokitbot
Copy link
Collaborator

🎉 This PR is included in version 15.2.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants