Update symbol template test case with errors to include union types
This commit is contained in:
parent
4e5c7be228
commit
5338500c05
|
@ -1,9 +1,11 @@
|
|||
tests/cases/compiler/noImplicitSymbolToString.ts(6,30): error TS2352: Type 'symbol' cannot be converted to type 'string'.
|
||||
tests/cases/compiler/noImplicitSymbolToString.ts(7,30): error TS2469: The '+' operator cannot be applied to type 'symbol'.
|
||||
tests/cases/compiler/noImplicitSymbolToString.ts(8,8): error TS2469: The '+=' operator cannot be applied to type 'symbol'.
|
||||
tests/cases/compiler/noImplicitSymbolToString.ts(13,47): error TS2352: Type 'symbol' cannot be converted to type 'string'.
|
||||
tests/cases/compiler/noImplicitSymbolToString.ts(13,90): error TS2352: Type 'symbol' cannot be converted to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/noImplicitSymbolToString.ts (3 errors) ====
|
||||
==== tests/cases/compiler/noImplicitSymbolToString.ts (5 errors) ====
|
||||
// Fix #19666
|
||||
|
||||
let symbol!: symbol;
|
||||
|
@ -18,4 +20,13 @@ tests/cases/compiler/noImplicitSymbolToString.ts(8,8): error TS2469: The '+=' op
|
|||
str += symbol;
|
||||
~~~~~~
|
||||
!!! error TS2469: The '+=' operator cannot be applied to type 'symbol'.
|
||||
|
||||
let symbolUnionNumber!: symbol | number;
|
||||
let symbolUnionString!: symbol | string;
|
||||
|
||||
const templateStrUnion = `union with number ${symbolUnionNumber} and union with string ${symbolUnionString}`;
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2352: Type 'symbol' cannot be converted to type 'string'.
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2352: Type 'symbol' cannot be converted to type 'string'.
|
||||
|
|
@ -7,6 +7,11 @@ let str = "hello ";
|
|||
const templateStr = `hello ${symbol}`;
|
||||
const appendStr = "hello " + symbol;
|
||||
str += symbol;
|
||||
|
||||
let symbolUnionNumber!: symbol | number;
|
||||
let symbolUnionString!: symbol | string;
|
||||
|
||||
const templateStrUnion = `union with number ${symbolUnionNumber} and union with string ${symbolUnionString}`;
|
||||
|
||||
|
||||
//// [noImplicitSymbolToString.js]
|
||||
|
@ -16,3 +21,6 @@ var str = "hello ";
|
|||
var templateStr = "hello " + symbol;
|
||||
var appendStr = "hello " + symbol;
|
||||
str += symbol;
|
||||
var symbolUnionNumber;
|
||||
var symbolUnionString;
|
||||
var templateStrUnion = "union with number " + symbolUnionNumber + " and union with string " + symbolUnionString;
|
||||
|
|
|
@ -19,3 +19,14 @@ str += symbol;
|
|||
>str : Symbol(str, Decl(noImplicitSymbolToString.ts, 3, 3))
|
||||
>symbol : Symbol(symbol, Decl(noImplicitSymbolToString.ts, 2, 3))
|
||||
|
||||
let symbolUnionNumber!: symbol | number;
|
||||
>symbolUnionNumber : Symbol(symbolUnionNumber, Decl(noImplicitSymbolToString.ts, 9, 3))
|
||||
|
||||
let symbolUnionString!: symbol | string;
|
||||
>symbolUnionString : Symbol(symbolUnionString, Decl(noImplicitSymbolToString.ts, 10, 3))
|
||||
|
||||
const templateStrUnion = `union with number ${symbolUnionNumber} and union with string ${symbolUnionString}`;
|
||||
>templateStrUnion : Symbol(templateStrUnion, Decl(noImplicitSymbolToString.ts, 12, 5))
|
||||
>symbolUnionNumber : Symbol(symbolUnionNumber, Decl(noImplicitSymbolToString.ts, 9, 3))
|
||||
>symbolUnionString : Symbol(symbolUnionString, Decl(noImplicitSymbolToString.ts, 10, 3))
|
||||
|
||||
|
|
|
@ -24,3 +24,15 @@ str += symbol;
|
|||
>str : string
|
||||
>symbol : symbol
|
||||
|
||||
let symbolUnionNumber!: symbol | number;
|
||||
>symbolUnionNumber : number | symbol
|
||||
|
||||
let symbolUnionString!: symbol | string;
|
||||
>symbolUnionString : string | symbol
|
||||
|
||||
const templateStrUnion = `union with number ${symbolUnionNumber} and union with string ${symbolUnionString}`;
|
||||
>templateStrUnion : string
|
||||
>`union with number ${symbolUnionNumber} and union with string ${symbolUnionString}` : string
|
||||
>symbolUnionNumber : number | symbol
|
||||
>symbolUnionString : string | symbol
|
||||
|
||||
|
|
|
@ -6,3 +6,8 @@ let str = "hello ";
|
|||
const templateStr = `hello ${symbol}`;
|
||||
const appendStr = "hello " + symbol;
|
||||
str += symbol;
|
||||
|
||||
let symbolUnionNumber!: symbol | number;
|
||||
let symbolUnionString!: symbol | string;
|
||||
|
||||
const templateStrUnion = `union with number ${symbolUnionNumber} and union with string ${symbolUnionString}`;
|
||||
|
|
Loading…
Reference in a new issue