Skip to content

Commit a95f9a0

Browse files
committed
feat(placeholders): Add placeholder types, etc.
1 parent 51ff106 commit a95f9a0

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

source/placeholders-spec.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* @license Use of this source code is governed by an MIT-style license that
3+
* can be found in the LICENSE file at https://github.com/cartant/ts-snippet
4+
*/
5+
/*tslint:disable:no-unused-expression*/
6+
7+
import { expecter } from "./expecter";
8+
9+
describe("placeholders", () => {
10+
11+
const expectSnippet = expecter();
12+
13+
it("should be importable into a snippet", () => {
14+
15+
const expect = expectSnippet(`
16+
import * as placeholders from "./source/placeholders";
17+
const assignedConstant = placeholders.c1;
18+
let assignedVariable = placeholders.v2;
19+
declare const declaredConstant: placeholders.T3;
20+
declare let declaredVariable: placeholders.T4;
21+
`);
22+
expect.toInfer("assignedConstant", "T1");
23+
expect.toInfer("assignedVariable", "T2");
24+
expect.toInfer("declaredConstant", "T3");
25+
expect.toInfer("declaredVariable", "T4");
26+
});
27+
});

source/placeholders.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* @license Use of this source code is governed by an MIT-style license that
3+
* can be found in the LICENSE file at https://github.com/cartant/ts-snippet
4+
*/
5+
6+
export interface T1 { kind: "T1"; }
7+
export interface T2 { kind: "T2"; }
8+
export interface T3 { kind: "T3"; }
9+
export interface T4 { kind: "T4"; }
10+
export interface T5 { kind: "T5"; }
11+
export interface T6 { kind: "T6"; }
12+
export interface T7 { kind: "T7"; }
13+
export interface T8 { kind: "T8"; }
14+
export interface T9 { kind: "T9"; }
15+
export interface T10 { kind: "T10"; }
16+
export interface T11 { kind: "T11"; }
17+
export interface T12 { kind: "T12"; }
18+
19+
export declare const c1: T1;
20+
export declare const c2: T2;
21+
export declare const c3: T3;
22+
export declare const c4: T4;
23+
export declare const c5: T5;
24+
export declare const c6: T6;
25+
export declare const c7: T7;
26+
export declare const c8: T8;
27+
export declare const c9: T9;
28+
export declare const c10: T10;
29+
export declare const c11: T11;
30+
export declare const c12: T12;
31+
32+
export declare let v1: T1;
33+
export declare let v2: T2;
34+
export declare let v3: T3;
35+
export declare let v4: T4;
36+
export declare let v5: T5;
37+
export declare let v6: T6;
38+
export declare let v7: T7;
39+
export declare let v8: T8;
40+
export declare let v9: T9;
41+
export declare let v10: T10;
42+
export declare let v11: T11;
43+
export declare let v12: T12;

0 commit comments

Comments
 (0)