30 lines
905 B
JavaScript
30 lines
905 B
JavaScript
|
//// [unionTypeLiterals.ts]
|
||
|
// basic valid forms of union literals
|
||
|
|
||
|
var simpleUnion: string | number;
|
||
|
var unionOfUnion: string | number | boolean;
|
||
|
|
||
|
var arrayOfUnions: (string | number)[];
|
||
|
var arrayOfUnions: Array<string | number>;
|
||
|
|
||
|
var unionOfFunctionType: (() => string) | (() => number);
|
||
|
var unionOfFunctionType: { (): string } | { (): number };
|
||
|
var unionOfFunctionType: () => string | number;
|
||
|
|
||
|
var unionOfConstructorType: (new () => string) | (new () => number);
|
||
|
var unionOfConstructorType: { new (): string } | { new (): number };
|
||
|
var unionOfConstructorType: new () => string | number;
|
||
|
|
||
|
//// [unionTypeLiterals.js]
|
||
|
// basic valid forms of union literals
|
||
|
var simpleUnion;
|
||
|
var unionOfUnion;
|
||
|
var arrayOfUnions;
|
||
|
var arrayOfUnions;
|
||
|
var unionOfFunctionType;
|
||
|
var unionOfFunctionType;
|
||
|
var unionOfFunctionType;
|
||
|
var unionOfConstructorType;
|
||
|
var unionOfConstructorType;
|
||
|
var unionOfConstructorType;
|