microsoft / microsoft/TypeScript
Migrate `String` to `StringPrototype`, `Number` to `NumberPrototype`, etc
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
Suggestion
🔍 Search Terms
string prototype object number stringprototype
✅ Viability Checklist
My suggestion meets these guidelines:
- 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 TypeScript's Design Goals.
⭐ Suggestion
We're always seeing people writing String, Number, Object, and so on, in places where they should be writing their primitive equivalents.
We should mark these as @deprecated so that they show up with strikethroughs in the editor, and make new global interfaces named e.g. StringPrototype so it's more clear what they're for.
/**
* @deprecated Use `string` when working with strings, or use `StringPrototype` to declare new string methods
*/
interface String {
For back compat, possibly forever, we'll need to declare these as
interface StringPrototype extends String { }
so that existing references to String["charAt"] continue to work and so that other merges continue to function.
📃 Motivating Example
💻 Use Cases
- New users coming to TS
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, tests, or entry points. Start by reviewing the proposed global interface changes and the linked TypeScript design goals; done would mean deprecated wrapper interfaces and compatible StringPrototype, NumberPrototype, and related declarations without breaking existing references.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100