TypeScript/tests/baselines/reference/declFileTypeAnnotationVisibilityErrorTypeAlias.types
Anders Hejlsberg 6aeb8c12cc
Preserve type aliases for union and intersection types (#42149)
* Create separate types for equivalent aliased unions

* Accept new baselines

* Preserve original types for union types

* Accept new baselines

* Preserve intersection origin for union types

* Accept new baselines

* Accept new baselines

* Preserve aliases during relationship checks

* Accept new baselines

* Preserve aliases for intersection and indexed access types

* Accept new baselines

* Compute intersection-of-unions cross product without recursion

* Accept new baselines

* Use denormalized type objects for origin / support 'keyof' origins

* Accept new baselines

* Fix fourslash test

* Recursively extract named union types

* Accept new baselines

* Map on union origin in mapType to better preserve aliases and origins

* Remove redundant call

* Accept new baselines

* Revert back to declared type when branches produce equivalent union

* Accept new baselines

* Don't include denormal origin types in regular type statistics

* Fix issue with unions not being marked primitive-only

* Allow new alias to be associated with type alias instantiation

* Accept new baselines

* Revert "Accept new baselines"

This reverts commit 4507270cc1.

* Revert "Allow new alias to be associated with type alias instantiation"

This reverts commit 2c2d06dfe1.
2021-01-08 15:19:58 -10:00

79 lines
1.2 KiB
Plaintext

=== tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeAlias.ts ===
interface Window {
someMethod();
>someMethod : () => any
}
module M {
>M : typeof M
type W = Window | string;
>W : W
export module N {
>N : typeof N
export class Window { }
>Window : Window
export var p: W; // Should report error that W is private
>p : W
}
}
module M1 {
>M1 : typeof M1
export type W = Window | string;
>W : W
export module N {
>N : typeof N
export class Window { }
>Window : Window
export var p: W; // No error
>p : W
}
}
module M2 {
>M2 : typeof M2
class private1 {
>private1 : private1
}
class public1 {
>public1 : public1
}
module m3 {
>m3 : typeof m3
export class public1 {
>public1 : public1
}
}
type t1 = private1;
>t1 : private1
export type t2 = private1; // error
>t2 : private1
type t11 = public1;
>t11 : public1
export type t12 = public1;
>t12 : public1
type t111 = m3.public1;
>t111 : m3.public1
>m3 : any
export type t112 = m3.public1; // error
>t112 : m3.public1
>m3 : any
}