Bug Report
Docs of charCodeAt and codePointAt are flipped. Described in MDN, the codePointAt returns Unicode code point, and charCodeAt returns UTF16 char code, however in JSDoc string of Typescript they are flipped.
How it is
|
/** |
|
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point |
|
* value of the UTF-16 encoded code point starting at the string element at position pos in |
|
* the String resulting from converting this object to a String. |
|
* If there is no element at that position, the result is undefined. |
|
* If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. |
|
*/ |
|
codePointAt(pos: number): number | undefined; |
|
/** |
|
* Returns the Unicode value of the character at the specified location. |
|
* @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. |
|
*/ |
|
charCodeAt(index: number): number; |
How it should be
The codePointAt() method returns a non-negative integer that is the Unicode code point value at the given position. Note that this function does not give the nth code point in a string, but the code point starting at the specified string index. Docs
The charCodeAt() method returns an integer between 0 and 65535 representing the UTF-16 code unit at the given index. Docs
Bug Report
Docs of
charCodeAtandcodePointAtare flipped. Described in MDN, thecodePointAtreturns Unicode code point, andcharCodeAtreturns UTF16 char code, however in JSDoc string of Typescript they are flipped.How it is
TypeScript/lib/lib.es2015.core.d.ts
Lines 401 to 408 in 89d05f7
TypeScript/lib/lib.es5.d.ts
Lines 404 to 408 in 89d05f7
How it should be