Skip to content

fix: Typescript typings #1134

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

Merged
merged 4 commits into from
Dec 19, 2017
Merged

fix: Typescript typings #1134

merged 4 commits into from
Dec 19, 2017

Conversation

pgrm
Copy link
Contributor

@pgrm pgrm commented Nov 16, 2017

Before submitting a pull request, please verify the following:

  • If you've added code that should be tested, please add tests.
  • If you've modified the API (e.g. added a new config or public method), update the docs and TypeScript declaration file.
  • Ensure your code lints and the test suite passes (npm test).

I tried applying the hack described here - #339 (comment) - in my angular (typescript) application, when I noticed that some types don't match.

  • I changed onFailure to onError and added correct parameter
  • I fixed the callback types for setXYZCallback

I went through the implementation and hope that I've renamed / adjusted everything correctly. Would be cool if you could merge and release these fixes soon. Thx

@pgrm pgrm changed the title change onFailure to onError and add correct parameter fix: Typescript typings - change onFailure to onError and add correct parameter Nov 17, 2017
@pgrm pgrm changed the title fix: Typescript typings - change onFailure to onError and add correct parameter fix: Typescript typings Nov 17, 2017
@@ -264,7 +264,7 @@ declare module Raven {
sentry_key: string;
};
onSuccess: () => void;
onFailure: () => void;
onError: (error: Error & { request: XMLHttpRequest }) => void;
Copy link
Contributor

@kamilogorek kamilogorek Nov 16, 2017

Choose a reason for hiding this comment

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

I don't know TS syntax much, so is this request already optional by using &, or does it have to be annotated somehow? Because it can be omitted in the code.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not, that'd have to be request?:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kamilogorek @SimonSchick I actually went through the code and thought that request is always set, but if you think it should be optional, it's fine with me - adjusted

@@ -264,7 +264,7 @@ declare module Raven {
sentry_key: string;
};
onSuccess: () => void;
onFailure: () => void;
onError: (error: Error & { request: XMLHttpRequest }) => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not, that'd have to be request?:

@@ -264,7 +266,7 @@ declare module Raven {
sentry_key: string;
};
onSuccess: () => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

Btw: onSuccess(): void in generally shorter and preferred for interfaces.

@pgrm
Copy link
Contributor Author

pgrm commented Nov 22, 2017

@SimonSchick @kamilogorek thx for the review, anything else I'm missing?

@kamilogorek
Copy link
Contributor

Looks good to me. Thanks!

@kamilogorek kamilogorek merged commit 7d7eee2 into getsentry:master Dec 19, 2017
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.

3 participants