|
| 1 | +//// [tests/cases/compiler/jsdocBracelessTypeTag1.ts] //// |
| 2 | + |
| 3 | +=== index.js === |
| 4 | +/** @type () => string */ |
| 5 | +function fn1() { |
| 6 | +>fn1 : Symbol(fn1, Decl(index.js, 0, 0)) |
| 7 | + |
| 8 | + return 42; |
| 9 | +} |
| 10 | + |
| 11 | +/** @type () => string */ |
| 12 | +function fn2() { |
| 13 | +>fn2 : Symbol(fn2, Decl(index.js, 3, 1)) |
| 14 | + |
| 15 | + return "foo"; |
| 16 | +} |
| 17 | + |
| 18 | +/** @type (arg: string) => string */ |
| 19 | +function fn3(arg) { |
| 20 | +>fn3 : Symbol(fn3, Decl(index.js, 8, 1)) |
| 21 | +>arg : Symbol(arg, Decl(index.js, 11, 13)) |
| 22 | + |
| 23 | + return arg; |
| 24 | +>arg : Symbol(arg, Decl(index.js, 11, 13)) |
| 25 | +} |
| 26 | + |
| 27 | +/** @type ({ type: 'foo' } | { type: 'bar' }) & { prop: number } */ |
| 28 | +const obj1 = { type: "foo", prop: 10 }; |
| 29 | +>obj1 : Symbol(obj1, Decl(index.js, 16, 5)) |
| 30 | +>type : Symbol(type, Decl(index.js, 16, 14)) |
| 31 | +>prop : Symbol(prop, Decl(index.js, 16, 27)) |
| 32 | + |
| 33 | +/** @type ({ type: 'foo' } | { type: 'bar' }) & { prop: number } */ |
| 34 | +const obj2 = { type: "other", prop: 10 }; |
| 35 | +>obj2 : Symbol(obj2, Decl(index.js, 19, 5)) |
| 36 | +>type : Symbol(type, Decl(index.js, 19, 14)) |
| 37 | +>prop : Symbol(prop, Decl(index.js, 19, 29)) |
| 38 | + |
0 commit comments