-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
936 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
tests/baselines/reference/staticIndexSignature3.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature3.ts(21,11): error TS7053: Element implicitly has an 'any' type because expression of type '"f"' can't be used to index type 'typeof D'. | ||
Property 'f' does not exist on type 'typeof D'. | ||
tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature3.ts(22,11): error TS7053: Element implicitly has an 'any' type because expression of type '42' can't be used to index type 'typeof D'. | ||
Property '42' does not exist on type 'typeof D'. | ||
tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature3.ts(23,11): error TS7053: Element implicitly has an 'any' type because expression of type '"f"' can't be used to index type 'typeof ED'. | ||
Property 'f' does not exist on type 'typeof ED'. | ||
tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature3.ts(24,11): error TS7053: Element implicitly has an 'any' type because expression of type '42' can't be used to index type 'typeof ED'. | ||
Property '42' does not exist on type 'typeof ED'. | ||
tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature3.ts(25,11): error TS7053: Element implicitly has an 'any' type because expression of type '"f"' can't be used to index type 'typeof DD'. | ||
Property 'f' does not exist on type 'typeof DD'. | ||
tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature3.ts(26,11): error TS7053: Element implicitly has an 'any' type because expression of type '42' can't be used to index type 'typeof DD'. | ||
Property '42' does not exist on type 'typeof DD'. | ||
|
||
|
||
==== tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature3.ts (6 errors) ==== | ||
class B { | ||
static readonly [s: string]: number; | ||
static readonly [s: number]: 42 | 233 | ||
} | ||
|
||
class D extends B { | ||
static readonly [s: string]: number | ||
} | ||
|
||
class ED extends D { | ||
static readonly [s: string]: boolean | ||
static readonly [s: number]: 1 | ||
} | ||
|
||
class DD extends D { | ||
static readonly [s: string]: 421 | ||
} | ||
|
||
const a = B["f"]; | ||
const b = B[42]; | ||
const c = D["f"] | ||
~~~~~~ | ||
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"f"' can't be used to index type 'typeof D'. | ||
!!! error TS7053: Property 'f' does not exist on type 'typeof D'. | ||
const d = D[42] | ||
~~~~~ | ||
!!! error TS7053: Element implicitly has an 'any' type because expression of type '42' can't be used to index type 'typeof D'. | ||
!!! error TS7053: Property '42' does not exist on type 'typeof D'. | ||
const e = ED["f"] | ||
~~~~~~~ | ||
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"f"' can't be used to index type 'typeof ED'. | ||
!!! error TS7053: Property 'f' does not exist on type 'typeof ED'. | ||
const f = ED[42] | ||
~~~~~~ | ||
!!! error TS7053: Element implicitly has an 'any' type because expression of type '42' can't be used to index type 'typeof ED'. | ||
!!! error TS7053: Property '42' does not exist on type 'typeof ED'. | ||
const g = DD["f"] | ||
~~~~~~~ | ||
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"f"' can't be used to index type 'typeof DD'. | ||
!!! error TS7053: Property 'f' does not exist on type 'typeof DD'. | ||
const h = DD[42] | ||
~~~~~~ | ||
!!! error TS7053: Element implicitly has an 'any' type because expression of type '42' can't be used to index type 'typeof DD'. | ||
!!! error TS7053: Property '42' does not exist on type 'typeof DD'. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
//// [staticIndexSignature3.ts] | ||
class B { | ||
static readonly [s: string]: number; | ||
static readonly [s: number]: 42 | 233 | ||
} | ||
|
||
class D extends B { | ||
static readonly [s: string]: number | ||
} | ||
|
||
class ED extends D { | ||
static readonly [s: string]: boolean | ||
static readonly [s: number]: 1 | ||
} | ||
|
||
class DD extends D { | ||
static readonly [s: string]: 421 | ||
} | ||
|
||
const a = B["f"]; | ||
const b = B[42]; | ||
const c = D["f"] | ||
const d = D[42] | ||
const e = ED["f"] | ||
const f = ED[42] | ||
const g = DD["f"] | ||
const h = DD[42] | ||
|
||
|
||
//// [staticIndexSignature3.js] | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var B = /** @class */ (function () { | ||
function B() { | ||
} | ||
return B; | ||
}()); | ||
var D = /** @class */ (function (_super) { | ||
__extends(D, _super); | ||
function D() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return D; | ||
}(B)); | ||
var ED = /** @class */ (function (_super) { | ||
__extends(ED, _super); | ||
function ED() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return ED; | ||
}(D)); | ||
var DD = /** @class */ (function (_super) { | ||
__extends(DD, _super); | ||
function DD() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return DD; | ||
}(D)); | ||
var a = B["f"]; | ||
var b = B[42]; | ||
var c = D["f"]; | ||
var d = D[42]; | ||
var e = ED["f"]; | ||
var f = ED[42]; | ||
var g = DD["f"]; | ||
var h = DD[42]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
=== tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature3.ts === | ||
class B { | ||
>B : Symbol(B, Decl(staticIndexSignature3.ts, 0, 0)) | ||
|
||
static readonly [s: string]: number; | ||
>s : Symbol(s, Decl(staticIndexSignature3.ts, 1, 21)) | ||
|
||
static readonly [s: number]: 42 | 233 | ||
>s : Symbol(s, Decl(staticIndexSignature3.ts, 2, 21)) | ||
} | ||
|
||
class D extends B { | ||
>D : Symbol(D, Decl(staticIndexSignature3.ts, 3, 1)) | ||
>B : Symbol(B, Decl(staticIndexSignature3.ts, 0, 0)) | ||
|
||
static readonly [s: string]: number | ||
>s : Symbol(s, Decl(staticIndexSignature3.ts, 6, 21)) | ||
} | ||
|
||
class ED extends D { | ||
>ED : Symbol(ED, Decl(staticIndexSignature3.ts, 7, 1)) | ||
>D : Symbol(D, Decl(staticIndexSignature3.ts, 3, 1)) | ||
|
||
static readonly [s: string]: boolean | ||
>s : Symbol(s, Decl(staticIndexSignature3.ts, 10, 21)) | ||
|
||
static readonly [s: number]: 1 | ||
>s : Symbol(s, Decl(staticIndexSignature3.ts, 11, 21)) | ||
} | ||
|
||
class DD extends D { | ||
>DD : Symbol(DD, Decl(staticIndexSignature3.ts, 12, 1)) | ||
>D : Symbol(D, Decl(staticIndexSignature3.ts, 3, 1)) | ||
|
||
static readonly [s: string]: 421 | ||
>s : Symbol(s, Decl(staticIndexSignature3.ts, 15, 21)) | ||
} | ||
|
||
const a = B["f"]; | ||
>a : Symbol(a, Decl(staticIndexSignature3.ts, 18, 5)) | ||
>B : Symbol(B, Decl(staticIndexSignature3.ts, 0, 0)) | ||
|
||
const b = B[42]; | ||
>b : Symbol(b, Decl(staticIndexSignature3.ts, 19, 5)) | ||
>B : Symbol(B, Decl(staticIndexSignature3.ts, 0, 0)) | ||
|
||
const c = D["f"] | ||
>c : Symbol(c, Decl(staticIndexSignature3.ts, 20, 5)) | ||
>D : Symbol(D, Decl(staticIndexSignature3.ts, 3, 1)) | ||
|
||
const d = D[42] | ||
>d : Symbol(d, Decl(staticIndexSignature3.ts, 21, 5)) | ||
>D : Symbol(D, Decl(staticIndexSignature3.ts, 3, 1)) | ||
|
||
const e = ED["f"] | ||
>e : Symbol(e, Decl(staticIndexSignature3.ts, 22, 5)) | ||
>ED : Symbol(ED, Decl(staticIndexSignature3.ts, 7, 1)) | ||
|
||
const f = ED[42] | ||
>f : Symbol(f, Decl(staticIndexSignature3.ts, 23, 5)) | ||
>ED : Symbol(ED, Decl(staticIndexSignature3.ts, 7, 1)) | ||
|
||
const g = DD["f"] | ||
>g : Symbol(g, Decl(staticIndexSignature3.ts, 24, 5)) | ||
>DD : Symbol(DD, Decl(staticIndexSignature3.ts, 12, 1)) | ||
|
||
const h = DD[42] | ||
>h : Symbol(h, Decl(staticIndexSignature3.ts, 25, 5)) | ||
>DD : Symbol(DD, Decl(staticIndexSignature3.ts, 12, 1)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
=== tests/cases/conformance/classes/staticIndexSignature/staticIndexSignature3.ts === | ||
class B { | ||
>B : B | ||
|
||
static readonly [s: string]: number; | ||
>s : string | ||
|
||
static readonly [s: number]: 42 | 233 | ||
>s : number | ||
} | ||
|
||
class D extends B { | ||
>D : D | ||
>B : B | ||
|
||
static readonly [s: string]: number | ||
>s : string | ||
} | ||
|
||
class ED extends D { | ||
>ED : ED | ||
>D : D | ||
|
||
static readonly [s: string]: boolean | ||
>s : string | ||
|
||
static readonly [s: number]: 1 | ||
>s : number | ||
} | ||
|
||
class DD extends D { | ||
>DD : DD | ||
>D : D | ||
|
||
static readonly [s: string]: 421 | ||
>s : string | ||
} | ||
|
||
const a = B["f"]; | ||
>a : number | ||
>B["f"] : number | ||
>B : typeof B | ||
>"f" : "f" | ||
|
||
const b = B[42]; | ||
>b : 42 | 233 | ||
>B[42] : 42 | 233 | ||
>B : typeof B | ||
>42 : 42 | ||
|
||
const c = D["f"] | ||
>c : any | ||
>D["f"] : any | ||
>D : typeof D | ||
>"f" : "f" | ||
|
||
const d = D[42] | ||
>d : any | ||
>D[42] : any | ||
>D : typeof D | ||
>42 : 42 | ||
|
||
const e = ED["f"] | ||
>e : any | ||
>ED["f"] : any | ||
>ED : typeof ED | ||
>"f" : "f" | ||
|
||
const f = ED[42] | ||
>f : any | ||
>ED[42] : any | ||
>ED : typeof ED | ||
>42 : 42 | ||
|
||
const g = DD["f"] | ||
>g : any | ||
>DD["f"] : any | ||
>DD : typeof DD | ||
>"f" : "f" | ||
|
||
const h = DD[42] | ||
>h : any | ||
>DD[42] : any | ||
>DD : typeof DD | ||
>42 : 42 | ||
|
Oops, something went wrong.