• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// @strict: true
2
3declare let optionalProperties: { k1?: string };
4declare let undefinedProperties: { k1: string | undefined };
5
6declare let stringDictionary: { [key: string]: string };
7stringDictionary = optionalProperties;  // ok
8stringDictionary = undefinedProperties; // error
9
10declare let probablyArray: { [key: number]: string };
11declare let numberLiteralKeys: { 1?: string };
12probablyArray = numberLiteralKeys;  // error
13
14declare let optionalUndefined: { k1?: undefined };
15let dict: { [key: string]: string } = optionalUndefined; // error
16
17function f<T>() {
18	let optional: { k1?: T } = undefined!;
19	let dict: { [key: string]: T | number } = optional; // ok
20}
21