Microsoft/TypeScript
Auf GitHub ansehenDocs of `charCodeAt` and `codePointAt` are flipped
Open
#49.561 geöffnet am 15. Juni 2022
BugDomain: lib.d.tsHelp Wanted
Repository-Metriken
- Stars
- (48.455 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)
Beschreibung
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
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