1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
tests/cases/compiler/functionLikeInParameterInitializer.ts(2,34): error TS2373: Initializer of parameter 'func' cannot reference identifier 'foo' declared after it.
tests/cases/compiler/functionLikeInParameterInitializer.ts(6,44): error TS2373: Initializer of parameter 'func' cannot reference identifier 'foo' declared after it.
tests/cases/compiler/functionLikeInParameterInitializer.ts(11,50): error TS2373: Initializer of parameter 'func' cannot reference identifier 'foo' declared after it.
tests/cases/compiler/functionLikeInParameterInitializer.ts(16,41): error TS2373: Initializer of parameter 'func' cannot reference identifier 'foo' declared after it.
==== tests/cases/compiler/functionLikeInParameterInitializer.ts (4 errors) ====
// error
export function bar(func = () => foo) {
~~~
!!! error TS2373: Initializer of parameter 'func' cannot reference identifier 'foo' declared after it.
let foo = "in";
}
// error
export function baz1(func = { f() { return foo } }) {
~~~
!!! error TS2373: Initializer of parameter 'func' cannot reference identifier 'foo' declared after it.
let foo = "in";
}
// error
export function baz2(func = function () { return foo }) {
~~~
!!! error TS2373: Initializer of parameter 'func' cannot reference identifier 'foo' declared after it.
let foo = "in";
}
// error
export function baz3(func = class { x = foo }) {
~~~
!!! error TS2373: Initializer of parameter 'func' cannot reference identifier 'foo' declared after it.
let foo = "in";
}
|