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

Backward-compatible accessor emit #33880

Closed
wants to merge 1 commit into from

Conversation

sandersn
Copy link
Member

@sandersn sandersn commented Oct 8, 2019

Accessors are now only emitted in d.ts when useDefineForClassFields is set. Otherwise, properties that originated as accessors are prefixed with a JSDoc tag: /**@accessor*/

The checker now understands /**@accessor*/ tags for the purpose of error reporting; if --useDefineForClassFields is provided, an ambient base property with /**@accessor*/ will be treated as an accessor, not as a property.

Reverts the declarations.ts part of #33509.

Eventually the new d.ts emit should become the default, once there are enough versions of Typescript that can parse the new syntax. At that point this code will once again go away.

Accessors are now only emitted in d.ts when useDefineForClassFields is set.
Otherwise, properties that originated as accessors are prefixed with
a JSDoc tag: `/**@Accessor*/`

The checker now understands `/**@Accessor*/` tags for the purpose of
error reporting; if --useDefineForClassFields is provided, an ambient
base property with `/**@Accessor*/` will be treated as an accessor, not
as a property.
@AviVahl
Copy link

AviVahl commented Oct 16, 2019

@sandersn would this approach hold for people using the "removeComments" field of compiler options?

@sandersn
Copy link
Member Author

It should, but I have not tested it.

I decided not to take this PR, however. Instead I recommend that people who need 3.5-compatible d.ts files use a tool like https://github.com/sandersn/downlevel-dts.

@sandersn sandersn closed this Oct 17, 2019
@jakebailey jakebailey deleted the backward-compatible-accessor-emit branch November 7, 2022 17:34
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.

2 participants