mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
32 lines
1020 B
Plaintext
32 lines
1020 B
Plaintext
foo.ts(11,8): error TS18033: Type 'string' is not assignable to type 'number' as required for computed enum member values.
|
|
foo.ts(12,8): error TS18033: Type 'string' is not assignable to type 'number' as required for computed enum member values.
|
|
|
|
|
|
==== foo.ts (2 errors) ====
|
|
import { BAR } from './bar';
|
|
const LOCAL = 'LOCAL';
|
|
|
|
enum Foo {
|
|
A = `${BAR}`,
|
|
|
|
B = LOCAL,
|
|
C = B,
|
|
D = C + 'BAR',
|
|
|
|
E1 = (`${BAR}`) as string, // We could recognize these,
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS18033: Type 'string' is not assignable to type 'number' as required for computed enum member values.
|
|
E2 = `${BAR}`!, // but Babel doesn't
|
|
~~~~~~~~~
|
|
!!! error TS18033: Type 'string' is not assignable to type 'number' as required for computed enum member values.
|
|
|
|
F = BAR,
|
|
G = 2 + BAR,
|
|
|
|
H = A,
|
|
I = H + BAR,
|
|
J = H
|
|
}
|
|
|
|
==== bar.ts (0 errors) ====
|
|
export const BAR = 'bar'; |