mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Adding test
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
//// [implicitIndexSignatures.ts]
|
||||
type StringMap = { [x: string]: string };
|
||||
|
||||
const empty1 = {};
|
||||
let empty2: {};
|
||||
const names1 = { a: "foo", b: "bar" };
|
||||
let names2: { a: string, b: string };
|
||||
let map: StringMap;
|
||||
map = { x: "xxx", y: "yyy" };
|
||||
map = empty1;
|
||||
map = empty2;
|
||||
map = names1;
|
||||
map = names2;
|
||||
|
||||
declare function getStringIndexValue<T>(map: { [x: string]: T }): T;
|
||||
declare function getNumberIndexValue<T>(map: { [x: number]: T }): T;
|
||||
|
||||
function f1() {
|
||||
const o1 = { a: 1, b: 2 };
|
||||
let o2: { a: number, b: number };
|
||||
const v1 = getStringIndexValue(o1);
|
||||
const v2 = getStringIndexValue(o2);
|
||||
}
|
||||
|
||||
function f2() {
|
||||
const o1 = { a: "1", b: "2" };
|
||||
let o2: { a: string, b: string };
|
||||
const v1 = getStringIndexValue(o1);
|
||||
const v2 = getStringIndexValue(o2);
|
||||
}
|
||||
|
||||
function f3() {
|
||||
const o1 = { a: 1, b: "2" };
|
||||
let o2: { a: number, b: string };
|
||||
const v1 = getStringIndexValue(o1);
|
||||
const v2 = getStringIndexValue(o2);
|
||||
}
|
||||
|
||||
function f4() {
|
||||
const o1 = { 0: "0", 1: "1", count: 2 };
|
||||
let o2: { 0: string, 1: string, count: number };
|
||||
const v1 = getStringIndexValue(o1);
|
||||
const v2 = getStringIndexValue(o2);
|
||||
const v3 = getNumberIndexValue(o1);
|
||||
const v4 = getNumberIndexValue(o2);
|
||||
}
|
||||
|
||||
|
||||
//// [implicitIndexSignatures.js]
|
||||
var empty1 = {};
|
||||
var empty2;
|
||||
var names1 = { a: "foo", b: "bar" };
|
||||
var names2;
|
||||
var map;
|
||||
map = { x: "xxx", y: "yyy" };
|
||||
map = empty1;
|
||||
map = empty2;
|
||||
map = names1;
|
||||
map = names2;
|
||||
function f1() {
|
||||
var o1 = { a: 1, b: 2 };
|
||||
var o2;
|
||||
var v1 = getStringIndexValue(o1);
|
||||
var v2 = getStringIndexValue(o2);
|
||||
}
|
||||
function f2() {
|
||||
var o1 = { a: "1", b: "2" };
|
||||
var o2;
|
||||
var v1 = getStringIndexValue(o1);
|
||||
var v2 = getStringIndexValue(o2);
|
||||
}
|
||||
function f3() {
|
||||
var o1 = { a: 1, b: "2" };
|
||||
var o2;
|
||||
var v1 = getStringIndexValue(o1);
|
||||
var v2 = getStringIndexValue(o2);
|
||||
}
|
||||
function f4() {
|
||||
var o1 = { 0: "0", 1: "1", count: 2 };
|
||||
var o2;
|
||||
var v1 = getStringIndexValue(o1);
|
||||
var v2 = getStringIndexValue(o2);
|
||||
var v3 = getNumberIndexValue(o1);
|
||||
var v4 = getNumberIndexValue(o2);
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
=== tests/cases/compiler/implicitIndexSignatures.ts ===
|
||||
type StringMap = { [x: string]: string };
|
||||
>StringMap : Symbol(StringMap, Decl(implicitIndexSignatures.ts, 0, 0))
|
||||
>x : Symbol(x, Decl(implicitIndexSignatures.ts, 0, 20))
|
||||
|
||||
const empty1 = {};
|
||||
>empty1 : Symbol(empty1, Decl(implicitIndexSignatures.ts, 2, 5))
|
||||
|
||||
let empty2: {};
|
||||
>empty2 : Symbol(empty2, Decl(implicitIndexSignatures.ts, 3, 3))
|
||||
|
||||
const names1 = { a: "foo", b: "bar" };
|
||||
>names1 : Symbol(names1, Decl(implicitIndexSignatures.ts, 4, 5))
|
||||
>a : Symbol(a, Decl(implicitIndexSignatures.ts, 4, 16))
|
||||
>b : Symbol(b, Decl(implicitIndexSignatures.ts, 4, 26))
|
||||
|
||||
let names2: { a: string, b: string };
|
||||
>names2 : Symbol(names2, Decl(implicitIndexSignatures.ts, 5, 3))
|
||||
>a : Symbol(a, Decl(implicitIndexSignatures.ts, 5, 13))
|
||||
>b : Symbol(b, Decl(implicitIndexSignatures.ts, 5, 24))
|
||||
|
||||
let map: StringMap;
|
||||
>map : Symbol(map, Decl(implicitIndexSignatures.ts, 6, 3))
|
||||
>StringMap : Symbol(StringMap, Decl(implicitIndexSignatures.ts, 0, 0))
|
||||
|
||||
map = { x: "xxx", y: "yyy" };
|
||||
>map : Symbol(map, Decl(implicitIndexSignatures.ts, 6, 3))
|
||||
>x : Symbol(x, Decl(implicitIndexSignatures.ts, 7, 7))
|
||||
>y : Symbol(y, Decl(implicitIndexSignatures.ts, 7, 17))
|
||||
|
||||
map = empty1;
|
||||
>map : Symbol(map, Decl(implicitIndexSignatures.ts, 6, 3))
|
||||
>empty1 : Symbol(empty1, Decl(implicitIndexSignatures.ts, 2, 5))
|
||||
|
||||
map = empty2;
|
||||
>map : Symbol(map, Decl(implicitIndexSignatures.ts, 6, 3))
|
||||
>empty2 : Symbol(empty2, Decl(implicitIndexSignatures.ts, 3, 3))
|
||||
|
||||
map = names1;
|
||||
>map : Symbol(map, Decl(implicitIndexSignatures.ts, 6, 3))
|
||||
>names1 : Symbol(names1, Decl(implicitIndexSignatures.ts, 4, 5))
|
||||
|
||||
map = names2;
|
||||
>map : Symbol(map, Decl(implicitIndexSignatures.ts, 6, 3))
|
||||
>names2 : Symbol(names2, Decl(implicitIndexSignatures.ts, 5, 3))
|
||||
|
||||
declare function getStringIndexValue<T>(map: { [x: string]: T }): T;
|
||||
>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13))
|
||||
>T : Symbol(T, Decl(implicitIndexSignatures.ts, 13, 37))
|
||||
>map : Symbol(map, Decl(implicitIndexSignatures.ts, 13, 40))
|
||||
>x : Symbol(x, Decl(implicitIndexSignatures.ts, 13, 48))
|
||||
>T : Symbol(T, Decl(implicitIndexSignatures.ts, 13, 37))
|
||||
>T : Symbol(T, Decl(implicitIndexSignatures.ts, 13, 37))
|
||||
|
||||
declare function getNumberIndexValue<T>(map: { [x: number]: T }): T;
|
||||
>getNumberIndexValue : Symbol(getNumberIndexValue, Decl(implicitIndexSignatures.ts, 13, 68))
|
||||
>T : Symbol(T, Decl(implicitIndexSignatures.ts, 14, 37))
|
||||
>map : Symbol(map, Decl(implicitIndexSignatures.ts, 14, 40))
|
||||
>x : Symbol(x, Decl(implicitIndexSignatures.ts, 14, 48))
|
||||
>T : Symbol(T, Decl(implicitIndexSignatures.ts, 14, 37))
|
||||
>T : Symbol(T, Decl(implicitIndexSignatures.ts, 14, 37))
|
||||
|
||||
function f1() {
|
||||
>f1 : Symbol(f1, Decl(implicitIndexSignatures.ts, 14, 68))
|
||||
|
||||
const o1 = { a: 1, b: 2 };
|
||||
>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 17, 9))
|
||||
>a : Symbol(a, Decl(implicitIndexSignatures.ts, 17, 16))
|
||||
>b : Symbol(b, Decl(implicitIndexSignatures.ts, 17, 22))
|
||||
|
||||
let o2: { a: number, b: number };
|
||||
>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 18, 7))
|
||||
>a : Symbol(a, Decl(implicitIndexSignatures.ts, 18, 13))
|
||||
>b : Symbol(b, Decl(implicitIndexSignatures.ts, 18, 24))
|
||||
|
||||
const v1 = getStringIndexValue(o1);
|
||||
>v1 : Symbol(v1, Decl(implicitIndexSignatures.ts, 19, 9))
|
||||
>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13))
|
||||
>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 17, 9))
|
||||
|
||||
const v2 = getStringIndexValue(o2);
|
||||
>v2 : Symbol(v2, Decl(implicitIndexSignatures.ts, 20, 9))
|
||||
>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13))
|
||||
>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 18, 7))
|
||||
}
|
||||
|
||||
function f2() {
|
||||
>f2 : Symbol(f2, Decl(implicitIndexSignatures.ts, 21, 1))
|
||||
|
||||
const o1 = { a: "1", b: "2" };
|
||||
>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 24, 9))
|
||||
>a : Symbol(a, Decl(implicitIndexSignatures.ts, 24, 16))
|
||||
>b : Symbol(b, Decl(implicitIndexSignatures.ts, 24, 24))
|
||||
|
||||
let o2: { a: string, b: string };
|
||||
>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 25, 7))
|
||||
>a : Symbol(a, Decl(implicitIndexSignatures.ts, 25, 13))
|
||||
>b : Symbol(b, Decl(implicitIndexSignatures.ts, 25, 24))
|
||||
|
||||
const v1 = getStringIndexValue(o1);
|
||||
>v1 : Symbol(v1, Decl(implicitIndexSignatures.ts, 26, 9))
|
||||
>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13))
|
||||
>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 24, 9))
|
||||
|
||||
const v2 = getStringIndexValue(o2);
|
||||
>v2 : Symbol(v2, Decl(implicitIndexSignatures.ts, 27, 9))
|
||||
>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13))
|
||||
>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 25, 7))
|
||||
}
|
||||
|
||||
function f3() {
|
||||
>f3 : Symbol(f3, Decl(implicitIndexSignatures.ts, 28, 1))
|
||||
|
||||
const o1 = { a: 1, b: "2" };
|
||||
>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 31, 9))
|
||||
>a : Symbol(a, Decl(implicitIndexSignatures.ts, 31, 16))
|
||||
>b : Symbol(b, Decl(implicitIndexSignatures.ts, 31, 22))
|
||||
|
||||
let o2: { a: number, b: string };
|
||||
>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 32, 7))
|
||||
>a : Symbol(a, Decl(implicitIndexSignatures.ts, 32, 13))
|
||||
>b : Symbol(b, Decl(implicitIndexSignatures.ts, 32, 24))
|
||||
|
||||
const v1 = getStringIndexValue(o1);
|
||||
>v1 : Symbol(v1, Decl(implicitIndexSignatures.ts, 33, 9))
|
||||
>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13))
|
||||
>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 31, 9))
|
||||
|
||||
const v2 = getStringIndexValue(o2);
|
||||
>v2 : Symbol(v2, Decl(implicitIndexSignatures.ts, 34, 9))
|
||||
>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13))
|
||||
>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 32, 7))
|
||||
}
|
||||
|
||||
function f4() {
|
||||
>f4 : Symbol(f4, Decl(implicitIndexSignatures.ts, 35, 1))
|
||||
|
||||
const o1 = { 0: "0", 1: "1", count: 2 };
|
||||
>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 38, 9))
|
||||
>count : Symbol(count, Decl(implicitIndexSignatures.ts, 38, 32))
|
||||
|
||||
let o2: { 0: string, 1: string, count: number };
|
||||
>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 39, 7))
|
||||
>count : Symbol(count, Decl(implicitIndexSignatures.ts, 39, 35))
|
||||
|
||||
const v1 = getStringIndexValue(o1);
|
||||
>v1 : Symbol(v1, Decl(implicitIndexSignatures.ts, 40, 9))
|
||||
>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13))
|
||||
>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 38, 9))
|
||||
|
||||
const v2 = getStringIndexValue(o2);
|
||||
>v2 : Symbol(v2, Decl(implicitIndexSignatures.ts, 41, 9))
|
||||
>getStringIndexValue : Symbol(getStringIndexValue, Decl(implicitIndexSignatures.ts, 11, 13))
|
||||
>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 39, 7))
|
||||
|
||||
const v3 = getNumberIndexValue(o1);
|
||||
>v3 : Symbol(v3, Decl(implicitIndexSignatures.ts, 42, 9))
|
||||
>getNumberIndexValue : Symbol(getNumberIndexValue, Decl(implicitIndexSignatures.ts, 13, 68))
|
||||
>o1 : Symbol(o1, Decl(implicitIndexSignatures.ts, 38, 9))
|
||||
|
||||
const v4 = getNumberIndexValue(o2);
|
||||
>v4 : Symbol(v4, Decl(implicitIndexSignatures.ts, 43, 9))
|
||||
>getNumberIndexValue : Symbol(getNumberIndexValue, Decl(implicitIndexSignatures.ts, 13, 68))
|
||||
>o2 : Symbol(o2, Decl(implicitIndexSignatures.ts, 39, 7))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
=== tests/cases/compiler/implicitIndexSignatures.ts ===
|
||||
type StringMap = { [x: string]: string };
|
||||
>StringMap : { [x: string]: string; }
|
||||
>x : string
|
||||
|
||||
const empty1 = {};
|
||||
>empty1 : {}
|
||||
>{} : {}
|
||||
|
||||
let empty2: {};
|
||||
>empty2 : {}
|
||||
|
||||
const names1 = { a: "foo", b: "bar" };
|
||||
>names1 : { a: string; b: string; }
|
||||
>{ a: "foo", b: "bar" } : { a: string; b: string; }
|
||||
>a : string
|
||||
>"foo" : string
|
||||
>b : string
|
||||
>"bar" : string
|
||||
|
||||
let names2: { a: string, b: string };
|
||||
>names2 : { a: string; b: string; }
|
||||
>a : string
|
||||
>b : string
|
||||
|
||||
let map: StringMap;
|
||||
>map : { [x: string]: string; }
|
||||
>StringMap : { [x: string]: string; }
|
||||
|
||||
map = { x: "xxx", y: "yyy" };
|
||||
>map = { x: "xxx", y: "yyy" } : { x: string; y: string; }
|
||||
>map : { [x: string]: string; }
|
||||
>{ x: "xxx", y: "yyy" } : { x: string; y: string; }
|
||||
>x : string
|
||||
>"xxx" : string
|
||||
>y : string
|
||||
>"yyy" : string
|
||||
|
||||
map = empty1;
|
||||
>map = empty1 : {}
|
||||
>map : { [x: string]: string; }
|
||||
>empty1 : {}
|
||||
|
||||
map = empty2;
|
||||
>map = empty2 : {}
|
||||
>map : { [x: string]: string; }
|
||||
>empty2 : {}
|
||||
|
||||
map = names1;
|
||||
>map = names1 : { a: string; b: string; }
|
||||
>map : { [x: string]: string; }
|
||||
>names1 : { a: string; b: string; }
|
||||
|
||||
map = names2;
|
||||
>map = names2 : { a: string; b: string; }
|
||||
>map : { [x: string]: string; }
|
||||
>names2 : { a: string; b: string; }
|
||||
|
||||
declare function getStringIndexValue<T>(map: { [x: string]: T }): T;
|
||||
>getStringIndexValue : <T>(map: { [x: string]: T; }) => T
|
||||
>T : T
|
||||
>map : { [x: string]: T; }
|
||||
>x : string
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
declare function getNumberIndexValue<T>(map: { [x: number]: T }): T;
|
||||
>getNumberIndexValue : <T>(map: { [x: number]: T; }) => T
|
||||
>T : T
|
||||
>map : { [x: number]: T; }
|
||||
>x : number
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
function f1() {
|
||||
>f1 : () => void
|
||||
|
||||
const o1 = { a: 1, b: 2 };
|
||||
>o1 : { a: number; b: number; }
|
||||
>{ a: 1, b: 2 } : { a: number; b: number; }
|
||||
>a : number
|
||||
>1 : number
|
||||
>b : number
|
||||
>2 : number
|
||||
|
||||
let o2: { a: number, b: number };
|
||||
>o2 : { a: number; b: number; }
|
||||
>a : number
|
||||
>b : number
|
||||
|
||||
const v1 = getStringIndexValue(o1);
|
||||
>v1 : number
|
||||
>getStringIndexValue(o1) : number
|
||||
>getStringIndexValue : <T>(map: { [x: string]: T; }) => T
|
||||
>o1 : { a: number; b: number; }
|
||||
|
||||
const v2 = getStringIndexValue(o2);
|
||||
>v2 : number
|
||||
>getStringIndexValue(o2) : number
|
||||
>getStringIndexValue : <T>(map: { [x: string]: T; }) => T
|
||||
>o2 : { a: number; b: number; }
|
||||
}
|
||||
|
||||
function f2() {
|
||||
>f2 : () => void
|
||||
|
||||
const o1 = { a: "1", b: "2" };
|
||||
>o1 : { a: string; b: string; }
|
||||
>{ a: "1", b: "2" } : { a: string; b: string; }
|
||||
>a : string
|
||||
>"1" : string
|
||||
>b : string
|
||||
>"2" : string
|
||||
|
||||
let o2: { a: string, b: string };
|
||||
>o2 : { a: string; b: string; }
|
||||
>a : string
|
||||
>b : string
|
||||
|
||||
const v1 = getStringIndexValue(o1);
|
||||
>v1 : string
|
||||
>getStringIndexValue(o1) : string
|
||||
>getStringIndexValue : <T>(map: { [x: string]: T; }) => T
|
||||
>o1 : { a: string; b: string; }
|
||||
|
||||
const v2 = getStringIndexValue(o2);
|
||||
>v2 : string
|
||||
>getStringIndexValue(o2) : string
|
||||
>getStringIndexValue : <T>(map: { [x: string]: T; }) => T
|
||||
>o2 : { a: string; b: string; }
|
||||
}
|
||||
|
||||
function f3() {
|
||||
>f3 : () => void
|
||||
|
||||
const o1 = { a: 1, b: "2" };
|
||||
>o1 : { a: number; b: string; }
|
||||
>{ a: 1, b: "2" } : { a: number; b: string; }
|
||||
>a : number
|
||||
>1 : number
|
||||
>b : string
|
||||
>"2" : string
|
||||
|
||||
let o2: { a: number, b: string };
|
||||
>o2 : { a: number; b: string; }
|
||||
>a : number
|
||||
>b : string
|
||||
|
||||
const v1 = getStringIndexValue(o1);
|
||||
>v1 : number | string
|
||||
>getStringIndexValue(o1) : number | string
|
||||
>getStringIndexValue : <T>(map: { [x: string]: T; }) => T
|
||||
>o1 : { a: number; b: string; }
|
||||
|
||||
const v2 = getStringIndexValue(o2);
|
||||
>v2 : number | string
|
||||
>getStringIndexValue(o2) : number | string
|
||||
>getStringIndexValue : <T>(map: { [x: string]: T; }) => T
|
||||
>o2 : { a: number; b: string; }
|
||||
}
|
||||
|
||||
function f4() {
|
||||
>f4 : () => void
|
||||
|
||||
const o1 = { 0: "0", 1: "1", count: 2 };
|
||||
>o1 : { 0: string; 1: string; count: number; }
|
||||
>{ 0: "0", 1: "1", count: 2 } : { 0: string; 1: string; count: number; }
|
||||
>"0" : string
|
||||
>"1" : string
|
||||
>count : number
|
||||
>2 : number
|
||||
|
||||
let o2: { 0: string, 1: string, count: number };
|
||||
>o2 : { 0: string; 1: string; count: number; }
|
||||
>count : number
|
||||
|
||||
const v1 = getStringIndexValue(o1);
|
||||
>v1 : string | number
|
||||
>getStringIndexValue(o1) : string | number
|
||||
>getStringIndexValue : <T>(map: { [x: string]: T; }) => T
|
||||
>o1 : { 0: string; 1: string; count: number; }
|
||||
|
||||
const v2 = getStringIndexValue(o2);
|
||||
>v2 : string | number
|
||||
>getStringIndexValue(o2) : string | number
|
||||
>getStringIndexValue : <T>(map: { [x: string]: T; }) => T
|
||||
>o2 : { 0: string; 1: string; count: number; }
|
||||
|
||||
const v3 = getNumberIndexValue(o1);
|
||||
>v3 : string
|
||||
>getNumberIndexValue(o1) : string
|
||||
>getNumberIndexValue : <T>(map: { [x: number]: T; }) => T
|
||||
>o1 : { 0: string; 1: string; count: number; }
|
||||
|
||||
const v4 = getNumberIndexValue(o2);
|
||||
>v4 : string
|
||||
>getNumberIndexValue(o2) : string
|
||||
>getNumberIndexValue : <T>(map: { [x: number]: T; }) => T
|
||||
>o2 : { 0: string; 1: string; count: number; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
type StringMap = { [x: string]: string };
|
||||
|
||||
const empty1 = {};
|
||||
let empty2: {};
|
||||
const names1 = { a: "foo", b: "bar" };
|
||||
let names2: { a: string, b: string };
|
||||
let map: StringMap;
|
||||
map = { x: "xxx", y: "yyy" };
|
||||
map = empty1;
|
||||
map = empty2;
|
||||
map = names1;
|
||||
map = names2;
|
||||
|
||||
declare function getStringIndexValue<T>(map: { [x: string]: T }): T;
|
||||
declare function getNumberIndexValue<T>(map: { [x: number]: T }): T;
|
||||
|
||||
function f1() {
|
||||
const o1 = { a: 1, b: 2 };
|
||||
let o2: { a: number, b: number };
|
||||
const v1 = getStringIndexValue(o1);
|
||||
const v2 = getStringIndexValue(o2);
|
||||
}
|
||||
|
||||
function f2() {
|
||||
const o1 = { a: "1", b: "2" };
|
||||
let o2: { a: string, b: string };
|
||||
const v1 = getStringIndexValue(o1);
|
||||
const v2 = getStringIndexValue(o2);
|
||||
}
|
||||
|
||||
function f3() {
|
||||
const o1 = { a: 1, b: "2" };
|
||||
let o2: { a: number, b: string };
|
||||
const v1 = getStringIndexValue(o1);
|
||||
const v2 = getStringIndexValue(o2);
|
||||
}
|
||||
|
||||
function f4() {
|
||||
const o1 = { 0: "0", 1: "1", count: 2 };
|
||||
let o2: { 0: string, 1: string, count: number };
|
||||
const v1 = getStringIndexValue(o1);
|
||||
const v2 = getStringIndexValue(o2);
|
||||
const v3 = getNumberIndexValue(o1);
|
||||
const v4 = getNumberIndexValue(o2);
|
||||
}
|
||||
Reference in New Issue
Block a user