-
Notifications
You must be signed in to change notification settings - Fork 531
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
fix(typescript): export correct types #4476
Conversation
This PR fixes some miscellaneous typescript issues discovered in angular instantsearch - if JS client v3 is used, it's imperative that the ts-ignore comments stay present, since not the same exports are used. Solution is to double-annotate to keep the multi-line version in exposed to the d.ts (see e.g. microsoft/TypeScript#39520) - similar in places.js - when updating TypeScript, I found that api-extractor can't deal with `import()` types, so those have to be transformed - fix stricter behaviour of tranformItems in hitsPerPage (we send the user the "render" values, not the one they entered) - SpeechRecognitionError is no longer exported in lib.d.ts, and is a generic Event now - updated Typescript to 3.8.3. I've tried 3.9.2 as well, but that has a bug with `function()` (transforms to `(arg:any) => ;` instead of `(arg:any) => any;`). I didn't open a TS issue for it, since it's fixed in v4 which we can migrate to later
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 9c009e1:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small suggestion about the import()
fix, beside that LGTM.
The @ts-ignore
solution is very hacky but I don't think we can have a better solution right now 😐
Did you try with TypeScript 4.0 RC and if yes does it really fix this problem ?
At least in the playground code like this was working in v4, but not 3.9: /**
* @param {function()} arg0
*/
function(arg0) {} I couldn’t find an issue for it though, but since it’s fixed, there must have been one |
Summary
This PR fixes some miscellaneous typescript issues discovered in angular instantsearch
Result
import
line microsoft/TypeScript#39520)import()
types, so those have to be transformedfunction()
(transforms to(arg:any) => ;
instead of(arg:any) => any;
). I didn't open a TS issue for it, since it's fixed in v4 which we can migrate to later