microsoft / microsoft/TypeScript
Missing Boolean.toString definition and loose valueOf definition
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
⚙ Compilation target
ES2017
⚙ Library
lib.es5.d.ts
Missing / Incorrect Definition
interface Boolean {
toString<T extends boolean>(this: T): `${T}`
toString(this: Boolean): `${boolean}`
valueOf<T extends boolean>(this: T): T
valueOf(this: Boolean): boolean
}
Sample Code
const bool = true as boolean;
let a: `${boolean}` = true.toString();
let b: `${boolean}` = false.toString();
let c: `${boolean}` = bool.toString();
let d: `${boolean}` = new Boolean().toString();
let e: `${boolean}` = Boolean().toString();
let f: true = true.valueOf();
let g: false = false.valueOf();
Documentation Link
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean/toString
https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-boolean.prototype.tostring
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean/valueOf
https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-boolean.prototype.valueof
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
Start in lib.es5.d.ts and compare the Boolean declarations with the issue's proposed signatures and the linked ECMAScript references. Verify the sample assignments for toString and valueOf compile with the intended literal types; done means the missing and overly broad definitions are corrected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100