Skip to content

Commit 76c3879

Browse files
committed
add extra test case
1 parent 93e81c4 commit 76c3879

4 files changed

+78
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//// [tests/cases/compiler/declarationEmitOptionalMappedTypePropertyNoStrictNullChecks4.ts] ////
2+
3+
//// [declarationEmitOptionalMappedTypePropertyNoStrictNullChecks4.ts]
4+
type InputType = { enable_member_receipts?: boolean };
5+
type AsEmptyObject<T> = { [K in keyof T]?: undefined };
6+
7+
export const test = {
8+
...({} as AsEmptyObject<InputType>),
9+
};
10+
11+
12+
13+
14+
//// [declarationEmitOptionalMappedTypePropertyNoStrictNullChecks4.d.ts]
15+
export declare const test: {
16+
enable_member_receipts?: undefined;
17+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//// [tests/cases/compiler/declarationEmitOptionalMappedTypePropertyNoStrictNullChecks4.ts] ////
2+
3+
=== declarationEmitOptionalMappedTypePropertyNoStrictNullChecks4.ts ===
4+
type InputType = { enable_member_receipts?: boolean };
5+
>InputType : Symbol(InputType, Decl(declarationEmitOptionalMappedTypePropertyNoStrictNullChecks4.ts, 0, 0))
6+
>enable_member_receipts : Symbol(enable_member_receipts, Decl(declarationEmitOptionalMappedTypePropertyNoStrictNullChecks4.ts, 0, 18))
7+
8+
type AsEmptyObject<T> = { [K in keyof T]?: undefined };
9+
>AsEmptyObject : Symbol(AsEmptyObject, Decl(declarationEmitOptionalMappedTypePropertyNoStrictNullChecks4.ts, 0, 54))
10+
>T : Symbol(T, Decl(declarationEmitOptionalMappedTypePropertyNoStrictNullChecks4.ts, 1, 19))
11+
>K : Symbol(K, Decl(declarationEmitOptionalMappedTypePropertyNoStrictNullChecks4.ts, 1, 27))
12+
>T : Symbol(T, Decl(declarationEmitOptionalMappedTypePropertyNoStrictNullChecks4.ts, 1, 19))
13+
14+
export const test = {
15+
>test : Symbol(test, Decl(declarationEmitOptionalMappedTypePropertyNoStrictNullChecks4.ts, 3, 12))
16+
17+
...({} as AsEmptyObject<InputType>),
18+
>AsEmptyObject : Symbol(AsEmptyObject, Decl(declarationEmitOptionalMappedTypePropertyNoStrictNullChecks4.ts, 0, 54))
19+
>InputType : Symbol(InputType, Decl(declarationEmitOptionalMappedTypePropertyNoStrictNullChecks4.ts, 0, 0))
20+
21+
};
22+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//// [tests/cases/compiler/declarationEmitOptionalMappedTypePropertyNoStrictNullChecks4.ts] ////
2+
3+
=== declarationEmitOptionalMappedTypePropertyNoStrictNullChecks4.ts ===
4+
type InputType = { enable_member_receipts?: boolean };
5+
>InputType : InputType
6+
> : ^^^^^^^^^
7+
>enable_member_receipts : boolean
8+
> : ^^^^^^^
9+
10+
type AsEmptyObject<T> = { [K in keyof T]?: undefined };
11+
>AsEmptyObject : AsEmptyObject<T>
12+
> : ^^^^^^^^^^^^^^^^
13+
14+
export const test = {
15+
>test : { enable_member_receipts?: undefined; }
16+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17+
>{ ...({} as AsEmptyObject<InputType>),} : { enable_member_receipts?: undefined; }
18+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19+
20+
...({} as AsEmptyObject<InputType>),
21+
>({} as AsEmptyObject<InputType>) : AsEmptyObject<InputType>
22+
> : ^^^^^^^^^^^^^^^^^^^^^^^^
23+
>{} as AsEmptyObject<InputType> : AsEmptyObject<InputType>
24+
> : ^^^^^^^^^^^^^^^^^^^^^^^^
25+
>{} : {}
26+
> : ^^
27+
28+
};
29+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @strictNullChecks: false
2+
// @declaration: true
3+
// @emitDeclarationOnly: true
4+
5+
type InputType = { enable_member_receipts?: boolean };
6+
type AsEmptyObject<T> = { [K in keyof T]?: undefined };
7+
8+
export const test = {
9+
...({} as AsEmptyObject<InputType>),
10+
};

0 commit comments

Comments
 (0)