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

Support isWellFormed and toWellFormed in lib.esnext.d.ts #55543

Closed
5 tasks done
iKingNinja opened this issue Aug 28, 2023 · 7 comments · Fixed by #58010
Closed
5 tasks done

Support isWellFormed and toWellFormed in lib.esnext.d.ts #55543

iKingNinja opened this issue Aug 28, 2023 · 7 comments · Fixed by #58010
Assignees
Labels
Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fix Available A PR has been opened for this issue Rescheduled This issue was previously scheduled to an earlier milestone

Comments

@iKingNinja
Copy link

iKingNinja commented Aug 28, 2023

🔍 Search Terms

NodeJS 20, isWellFormed, toWellFormed

✅ Viability Checklist

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals

⭐ Suggestion

NodeJS 20 introduces new features that are not supported by the TypeScript compiler yet.

As an example node version 20 introduces String.prototype.isWellFormed and String.prototype.toWellFormed. Using these functions causes error TS2339: Property 'isWellFormed' does not exist on type 'string'.

Current environment:

  • Node version: 20.5.1
  • TypeScript version: 5.2.2

📃 Motivating Example

This update will enable developers to fully use all features available in the latest major version of NodeJS.

💻 Use Cases

This would allow the usage of ECMAScript features such as isWellFormed and toWellFormed.

The only current workaround is to use // @ts-ignore to let the project compile.

@MartinJohns
Copy link
Contributor

MartinJohns commented Aug 28, 2023

NodeJS 20 introduces new features that are not supported by the TypeScript compiler yet.

How do these types require support by the TypeScript compiler? Sounds to me that it just needs updated @types/node definitions. Or alternatively augment the type definitions locally.

@iKingNinja
Copy link
Author

Because even with @types/node@20.5.7 installed the error keeps occurring.

@Josh-Cena
Copy link
Contributor

isWellFormed and toWellFormed are ES features, so they belong in the lib defs, not @types/node—the title is just misleading :)

@andrewbranch andrewbranch changed the title Support for NodeJS 20 features Support isWellFormed and toWellFormed in lib.esnext.d.ts Aug 28, 2023
@andrewbranch
Copy link
Member

AFAIK these should be added to lib.esnext.d.ts. @DanielRosenwasser @sandersn is it time to add a lib.es2024.d.ts? Do we have a fixed schedule for that?

@andrewbranch andrewbranch added the Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript label Aug 28, 2023
@andrewbranch andrewbranch added this to the TypeScript 5.3.0 milestone Aug 28, 2023
@DanielRosenwasser
Copy link
Member

I think usually we don't create a new target/library combo until the spec edition is ratified. I think esnext is probably the place for now.

@andrewbranch
Copy link
Member

Ah, I missed that https://tc39.es/ecma262/ shows the draft state. Is there a handy link that shows all spec versions and their statuses?

@Josh-Cena
Copy link
Contributor

@andrewbranch https://github.com/tc39/ecma262/releases

Every release is cut at around April–June, and new features are always mentioned in the introduction.

@RyanCavanaugh RyanCavanaugh added the Rescheduled This issue was previously scheduled to an earlier milestone label Mar 4, 2024
andreubotella added a commit to andreubotella/TypeScript that referenced this issue Mar 31, 2024
These two methods are part of the well-formed Unicode strings proposal
(https://github.com/tc39/proposal-is-usv-string), which reached stage 4 in
May 2023 and will be part of ES2024.

Fixes microsoft#55543.
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fix Available A PR has been opened for this issue Rescheduled This issue was previously scheduled to an earlier milestone
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants