mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
76 lines
2.5 KiB
Plaintext
76 lines
2.5 KiB
Plaintext
//// [tests/cases/compiler/destructuredDeclarationEmit.ts] ////
|
|
|
|
=== foo.ts ===
|
|
const foo = { bar: 'hello', bat: 'world', bam: { bork: { bar: 'a', baz: 'b' } } };
|
|
>foo : Symbol(foo, Decl(foo.ts, 0, 5))
|
|
>bar : Symbol(bar, Decl(foo.ts, 0, 13))
|
|
>bat : Symbol(bat, Decl(foo.ts, 0, 27))
|
|
>bam : Symbol(bam, Decl(foo.ts, 0, 41))
|
|
>bork : Symbol(bork, Decl(foo.ts, 0, 48))
|
|
>bar : Symbol(bar, Decl(foo.ts, 0, 56))
|
|
>baz : Symbol(baz, Decl(foo.ts, 0, 66))
|
|
|
|
const arr: [0, 1, 2, ['a', 'b', 'c', [{def: 'def'}, {sec: 'sec'}]]] = [0, 1, 2, ['a', 'b', 'c', [{def: 'def'}, {sec: 'sec'}]]];
|
|
>arr : Symbol(arr, Decl(foo.ts, 1, 5))
|
|
>def : Symbol(def, Decl(foo.ts, 1, 39))
|
|
>sec : Symbol(sec, Decl(foo.ts, 1, 53))
|
|
>def : Symbol(def, Decl(foo.ts, 1, 98))
|
|
>sec : Symbol(sec, Decl(foo.ts, 1, 112))
|
|
|
|
export { foo, arr };
|
|
>foo : Symbol(foo, Decl(foo.ts, 2, 8))
|
|
>arr : Symbol(arr, Decl(foo.ts, 2, 13))
|
|
|
|
=== index.ts ===
|
|
import { foo, arr } from './foo';
|
|
>foo : Symbol(foo, Decl(index.ts, 0, 8))
|
|
>arr : Symbol(arr, Decl(index.ts, 0, 13))
|
|
|
|
export { foo, arr };
|
|
>foo : Symbol(foo, Decl(index.ts, 1, 8))
|
|
>arr : Symbol(arr, Decl(index.ts, 1, 13))
|
|
|
|
const { bar: baz, bat, bam: { bork: { bar: ibar, baz: ibaz } } } = foo;
|
|
>bar : Symbol(bar, Decl(foo.ts, 0, 13))
|
|
>baz : Symbol(baz, Decl(index.ts, 3, 7))
|
|
>bat : Symbol(bat, Decl(index.ts, 3, 17))
|
|
>bam : Symbol(bam, Decl(foo.ts, 0, 41))
|
|
>bork : Symbol(bork, Decl(foo.ts, 0, 48))
|
|
>bar : Symbol(bar, Decl(foo.ts, 0, 56))
|
|
>ibar : Symbol(ibar, Decl(index.ts, 3, 37))
|
|
>baz : Symbol(baz, Decl(foo.ts, 0, 66))
|
|
>ibaz : Symbol(ibaz, Decl(index.ts, 3, 48))
|
|
>foo : Symbol(foo, Decl(index.ts, 0, 8))
|
|
|
|
export { baz, ibaz };
|
|
>baz : Symbol(baz, Decl(index.ts, 4, 8))
|
|
>ibaz : Symbol(ibaz, Decl(index.ts, 4, 13))
|
|
|
|
const [ , one, , [, bee, , [, {sec} ]]] = arr;
|
|
>one : Symbol(one, Decl(index.ts, 6, 9))
|
|
>bee : Symbol(bee, Decl(index.ts, 6, 19))
|
|
>sec : Symbol(sec, Decl(index.ts, 6, 31))
|
|
>arr : Symbol(arr, Decl(index.ts, 0, 13))
|
|
|
|
export { one, bee, sec };
|
|
>one : Symbol(one, Decl(index.ts, 7, 8))
|
|
>bee : Symbol(bee, Decl(index.ts, 7, 13))
|
|
>sec : Symbol(sec, Decl(index.ts, 7, 18))
|
|
|
|
const getFoo = () => ({
|
|
>getFoo : Symbol(getFoo, Decl(index.ts, 9, 5))
|
|
|
|
foo: 'foo'
|
|
>foo : Symbol(foo, Decl(index.ts, 9, 23))
|
|
|
|
});
|
|
|
|
const { foo: foo2 } = getFoo();
|
|
>foo : Symbol(foo, Decl(index.ts, 9, 23))
|
|
>foo2 : Symbol(foo2, Decl(index.ts, 13, 7))
|
|
>getFoo : Symbol(getFoo, Decl(index.ts, 9, 5))
|
|
|
|
export { foo2 };
|
|
>foo2 : Symbol(foo2, Decl(index.ts, 14, 8))
|
|
|