Skip to content

String method is wrongly allowed as a type #12146

Description

TypeScript Version: nightly (2.1.0-dev.20161110)

Code

// @Filename: a.d.ts
declare const x: "foo".charCodeAt(0);

Expected behavior:

An error; probably a syntax error.

Actual behavior:

x is of type number -- the return type of charCodeAt.

DIscovered at DefinitelyTyped/DefinitelyTyped#12603 (comment).

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions