forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherasableSyntaxOnlyDeclaration.ts
73 lines (55 loc) · 1.3 KB
/
erasableSyntaxOnlyDeclaration.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// @erasableSyntaxOnly: true
// @noEmit: true
// Diffs from the other test:
// - Parameter properties are already banned in .d.ts files
// @filename: index.d.cts
declare function foo(): void;
export = foo;
// @filename: index.d.ts
namespace IllegalBecauseInstantiated {
export const m = 1;
}
namespace AlsoIllegalBecauseInstantiated {
class PrivateClass {
}
}
enum NotLegalEnum {
B = 1
}
import NoGoodAlias = NotLegalEnum.B;
const enum NotLegalConstEnum {
C = 2
}
// No errors after this point
class MyClassOk {
// Not a parameter property, ok
constructor(foo: string);
}
namespace NotInstantiated {
export interface JustAType { }
export type ATypeInANamespace = {};
}
declare namespace AmbientIsNotInstantiated {
export const stillOk = 12;
}
declare enum LegalEnum {
A = 1
}
declare namespace AmbientStuff {
namespace Nested {
export const stillOk = 12;
}
enum EnumInAmbientContext {
B = 1
}
import FineAlias = EnumInAmbientContext.B;
}
// @filename: commonjs.d.cts
import foo = require("./other.cjs");
export = foo;
// @filename: other.d.cts
declare function foo(): void;
export = foo;
// @filename: esm.d.mts
declare const foo = 1234;
export default foo;