TypeScript/tests/baselines/reference/staticIndexSignature5.types
Wenlu Wang 41dc625b0a
Add static index signature (#37797)
* Add static index

* fix lint

* make lint happy

* adjust test cases

* add more cases

* fix changes

* Add more case

* accept baseline

* fix error if extends others

* Update vfsUtil.ts

* use equal to empty array

* static signature of interface is an error

* Accept baseline

* Check index constraints for static signature

* Accpet baseline

* Fix crash

* fix crash

* Accept baseline

* Fix regression

* Fix crash

* always return new array
2021-03-26 15:30:09 -07:00

54 lines
875 B
Plaintext

=== tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature5.ts ===
class B {
>B : B
static readonly [s: string]: number;
>s : string
static readonly [s: number]: 42 | 233
>s : number
}
interface I {
static readonly [s: string]: number;
>s : string
static readonly [s: number]: 42 | 233
>s : number
}
type TA = (typeof B)["foo"]
>TA : number
>B : typeof B
type TB = (typeof B)[42]
>TB : 42 | 233
>B : typeof B
type TC = (typeof B)[string]
>TC : number
>B : typeof B
type TD = (typeof B)[number]
>TD : 42 | 233
>B : typeof B
type TE = keyof typeof B;
>TE : string | number
>B : typeof B
type TF = Pick<typeof B, number>
>TF : TF
>B : typeof B
type TFI = Pick<I, number>
>TFI : TFI
type TG = Omit<typeof B, number>
>TG : TG
>B : typeof B
type TGI = Omit<I, number>
>TGI : TGI