Closed
Description
TypeScript Version: 1.8.0 / nightly (2.0.0-dev.201xxxxx) 2.0.2@rc
Code
interface FolderContentItem{
type: 'folder' | 'file';
}
let a:FolderContentItem[] = [];
a = [1,2,3,4,5].map(v=>({type:'folder'}))
Expected behavior:
Compiled successfully
Actual behavior:
test.ts(6,1): error TS2322: Type '{ type: string; }[]' is not assignable to type 'FolderContentItem[]'.
Type '{ type: string; }' is not assignable to type 'FolderContentItem'.
Types of property 'type' are incompatible.
Type 'string' is not assignable to type '"folder" | "file"'.
Metadata
Metadata
Assignees
Labels
No labels