TypeScript/tests/baselines/reference/stringPropertyAccess.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

38 lines
871 B
Plaintext

=== tests/cases/conformance/types/primitives/string/stringPropertyAccess.ts ===
var x = '';
>x : string
>'' : ""
var a = x.charAt(0);
>a : string
>x.charAt(0) : string
>x.charAt : (pos: number) => string
>x : string
>charAt : (pos: number) => string
>0 : 0
var b = x.hasOwnProperty('charAt');
>b : boolean
>x.hasOwnProperty('charAt') : boolean
>x.hasOwnProperty : (v: PropertyKey) => boolean
>x : string
>hasOwnProperty : (v: PropertyKey) => boolean
>'charAt' : "charAt"
var c = x['charAt'](0);
>c : string
>x['charAt'](0) : string
>x['charAt'] : (pos: number) => string
>x : string
>'charAt' : "charAt"
>0 : 0
var e = x['hasOwnProperty']('toFixed');
>e : boolean
>x['hasOwnProperty']('toFixed') : boolean
>x['hasOwnProperty'] : (v: PropertyKey) => boolean
>x : string
>'hasOwnProperty' : "hasOwnProperty"
>'toFixed' : "toFixed"