File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed
src/compiler/phases/1-parse
tests/runtime-runes/samples/typescript Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -105,12 +105,27 @@ const visitors = {
105
105
} ,
106
106
FunctionExpression : remove_this_param ,
107
107
FunctionDeclaration : remove_this_param ,
108
+ TSDeclareFunction ( ) {
109
+ return b . empty ;
110
+ } ,
111
+ ClassDeclaration ( node , context ) {
112
+ if ( node . declare ) {
113
+ return b . empty ;
114
+ }
115
+ return context . next ( ) ;
116
+ } ,
117
+ VariableDeclaration ( node , context ) {
118
+ if ( node . declare ) {
119
+ return b . empty ;
120
+ }
121
+ return context . next ( ) ;
122
+ } ,
108
123
TSModuleDeclaration ( node , context ) {
109
124
if ( ! node . body ) return b . empty ;
110
125
111
126
// namespaces can contain non-type nodes
112
- const cleaned = context . visit ( node . body . body ) ;
113
- if ( cleaned . length !== 0 ) {
127
+ const cleaned = /** @type { any[] } */ ( node . body . body ) . map ( ( entry ) => context . visit ( entry ) ) ;
128
+ if ( cleaned . some ( ( entry ) => entry !== b . empty ) ) {
114
129
e . typescript_invalid_feature ( node , 'namespaces with non-type nodes' ) ;
115
130
}
116
131
Original file line number Diff line number Diff line change 9
9
}
10
10
11
11
class Foo {
12
- constructor (public readonly name : string ) {}
12
+ constructor (readonly name : string ) {}
13
+ }
14
+
15
+ declare const declared_const: number ;
16
+ declare function declared_fn(): void ;
17
+ declare class declared_class {
18
+ foo: number ;
19
+ }
20
+
21
+ declare module ' foobar' {}
22
+ namespace SomeNamespace {
23
+ export type Foo = true
13
24
}
14
25
15
26
export type { Hello };
You can’t perform that action at this time.
0 commit comments