TypeScript/tests/baselines/reference/constEnum3.types
Wesley Wigham 78a99241d8
Reuse input type nodes when serializing signature parameter and return types (#37444)
* Accept change

* Accept the huge set of ever so slightly changed baselines

* Update return type logic to only reuse nodes if original nodes share scope with current node, like property types, only reuse nodes if symbols referened are acessible, reuse nodes for property signatures, too

* Only reuse nodes when a context is provided (otherwise identifier printback may fail)

* Only track symbol if symbol is found and no error is recorded

* Fix type parameter reuse lookup

* Forbid cjs module.exports references in retained nodes

* Adjust check for cjs export references to not include bad module type in output

* Add symbol to all identifiers we see in existing nodes for quickinfo

* Accept fourslash baseline updates

* Accept slightly updated baseline post-merge

* Do not copy original nodes for error types, replace empty type references with any
2020-04-01 19:50:21 -07:00

43 lines
899 B
Plaintext

=== tests/cases/conformance/constEnums/constEnum3.ts ===
const enum TestType { foo, bar }
>TestType : TestType
>foo : TestType.foo
>bar : TestType.bar
type TestTypeStr = keyof typeof TestType;
>TestTypeStr : "foo" | "bar"
>TestType : typeof TestType
function f1(f: TestType) { }
>f1 : (f: TestType) => void
>f : TestType
function f2(f: TestTypeStr) { }
>f2 : (f: TestTypeStr) => void
>f : "foo" | "bar"
f1(TestType.foo)
>f1(TestType.foo) : void
>f1 : (f: TestType) => void
>TestType.foo : TestType.foo
>TestType : typeof TestType
>foo : TestType.foo
f1(TestType.bar)
>f1(TestType.bar) : void
>f1 : (f: TestType) => void
>TestType.bar : TestType.bar
>TestType : typeof TestType
>bar : TestType.bar
f2('foo')
>f2('foo') : void
>f2 : (f: "foo" | "bar") => void
>'foo' : "foo"
f2('bar')
>f2('bar') : void
>f2 : (f: "foo" | "bar") => void
>'bar' : "bar"