mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
45 lines
884 B
TypeScript
45 lines
884 B
TypeScript
//// [tests/cases/compiler/functionLikeInParameterInitializer.ts] ////
|
|
|
|
//// [functionLikeInParameterInitializer.ts]
|
|
// error
|
|
export function bar(func = () => foo) {
|
|
let foo = "in";
|
|
}
|
|
// error
|
|
export function baz1(func = { f() { return foo } }) {
|
|
let foo = "in";
|
|
}
|
|
|
|
// error
|
|
export function baz2(func = function () { return foo }) {
|
|
let foo = "in";
|
|
}
|
|
|
|
// error
|
|
export function baz3(func = class { x = foo }) {
|
|
let foo = "in";
|
|
}
|
|
|
|
|
|
//// [functionLikeInParameterInitializer.js]
|
|
// error
|
|
export function bar(func = () => foo) {
|
|
let foo = "in";
|
|
}
|
|
// error
|
|
export function baz1(func = { f() { return foo; } }) {
|
|
let foo = "in";
|
|
}
|
|
// error
|
|
export function baz2(func = function () { return foo; }) {
|
|
let foo = "in";
|
|
}
|
|
// error
|
|
export function baz3(func = class {
|
|
constructor() {
|
|
this.x = foo;
|
|
}
|
|
}) {
|
|
let foo = "in";
|
|
}
|