-
Notifications
You must be signed in to change notification settings - Fork 622
[api-extractor] parsing error on (infer T extends U)
pattern
#3486
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
Comments
Apparently, this seems to be valid syntax only in TS 4.7 and API extractor is still using 4.6 😕 |
@iclanton it looks like you've helped with TypeScript version updates in the past (e.g. #3359, #3078)? I started a local branch to try to bump the TypeScript version, copying what appeared to have been done in past attempts, but am hitting a slew of eslint errors that look like this:
I imagine I'm doing something wrong. Here's my WIP branch: https://github.com/microsoft/rushstack/compare/main...zelliott:rushstack:upgrade-typescript?expand=1... some help would be greatly appreciated! |
Still on TS 4.7 syntax, I'm also running in troubles when trying to use variance annotation. export declare class Calculation<out D = string> {
static of(): Calculation;
} gives me
so it looks like the variance annotation is parsed as an extra type argument. |
TS has been updated to 4.7 in API extractor 7.29, and I'm not seeing these problems anymore 🎉 I'm closing the issue ✔️ |
Summary
In microsoft/TypeScript#49517 I reported a TS bug and was given a workaround which, unfortunately seems to break api-extractor 😢
My
.d.ts
file:Running
api-extractor
, I get the error:I assume it is on the
(infer T extends Foo)
pattern that it breaks, given that it used to work fine on older version of the code that was just usingV[P]
instead.Additionally, it seems that prettier also breaks because it expects a
?
after the innerextends
, so my guess it that api-extractor has a similar problem 🤔Repro steps
Creating a fresh TS project, install
api-extractor
with default config (api-extractor init
). Use the following TS file:Run
api-extractor --local
Expected result: API is successfully extracted
Actual result:
Details
Diagnostic:
diagnostic.txt
Standard questions
Please answer these questions to help us investigate your issue more quickly:
@microsoft/api-extractor
version?node -v
)?The text was updated successfully, but these errors were encountered: