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

Allow accessor properties in .d.ts even when targeting ES5 #61181

Open
6 tasks done
nicolo-ribaudo opened this issue Feb 15, 2025 · 2 comments
Open
6 tasks done

Allow accessor properties in .d.ts even when targeting ES5 #61181

nicolo-ribaudo opened this issue Feb 15, 2025 · 2 comments

Comments

@nicolo-ribaudo
Copy link

πŸ” Search Terms

Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.

βœ… Viability Checklist

⭐ Suggestion

TypeScript disallows accessor in class fields when targeting ES5:

Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher.

While I understand that there may be reason for TS to refuse transpiling accessor to ES5, it could allow using it in .d.ts files (or I guess in declare class classes).

πŸ“ƒ Motivating Example

babel/babel#17136

The .d.ts files for @babel/parser contain some accessor modifiers in classes. This shouldn't force consumers that want to transpile to ES5 to use skipLibCheck.

πŸ’» Use Cases

Same as what I wrote in the motivating example.

@Andarist
Copy link
Contributor

This is close - in its spirit - to #60438

@MartinJohns
Copy link
Contributor

Also downlevel-dts, although this project seems to be dead? @sandersn

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

No branches or pull requests

3 participants