You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`this` alias for `globalThis`| <pre><code>this.globby = true;</pre></code> | <pre><code>globalThis.globby = true;</pre></code> | When used at the top level of a script. |
@@ -98,17 +113,15 @@ However, if you see **_incorrect_** `.d.ts` output from a `.js` file, **please f
98
113
99
114
JSDoc types are parsed in normal type annotation position but show a grammar error. Corsa no longer parses the JSDoc types below, giving a parse error instead of a grammar error.
100
115
101
-
1. No postfix `T?` and `T!` types. Prefix `?T` and `!T` are still parsed and `!T` continues to have no semantics.
102
-
2. No Closure `function(string,string): void` types.
103
-
3. No JSDoc standalone `?` type.
104
-
4. No JSDoc module namepaths: `module:folder/file.C`
116
+
1. No Closure `function(string,string): void` types.
117
+
2. No JSDoc standalone `?` type.
118
+
3. No JSDoc module namepaths: `module:folder/file.C`
105
119
106
120
Corsa no longer parses the following JSDoc tags with a specific node type. They now parse as generic JSDocTag nodes.
107
121
108
122
1.`@class`/`@constructor`
109
-
2.`@throws`
110
-
3.`@author`
111
-
4.`@enum`
123
+
2.`@author`
124
+
3.`@enum`
112
125
113
126
## Checker
114
127
@@ -234,7 +247,7 @@ This means the declarations are accessible outside the class and may conflict wi
234
247
235
248
#### `@class` or `@constructor` does not make a function into a constructor function.
236
249
237
-
Corsa ignores `@class` and `@constructor`. This makes a difference on a function without this-property assignments or associated prototype-function assignments.
250
+
Constructor functions are no longer supported. See the Expandos section.
238
251
239
252
#### `@param` tags now apply to at most one function.
240
253
@@ -263,6 +276,40 @@ In Corsa, the behaviour is the same between TS and JS.
263
276
264
277
### Expandos
265
278
279
+
#### Constructor functions are no longer supported
280
+
281
+
Previously, you could create a constructor function either by assigning an expando property in the constructor, or an expando property to the function's prototype:
282
+
283
+
```js
284
+
functionC() {
285
+
this.property=1;
286
+
}
287
+
C.prototype.method=function() {}
288
+
```
289
+
290
+
Less common patterns, like assigning an object literal to the prototype, also need to be rewritten to use standard class syntax:
291
+
292
+
```js
293
+
functionFoo() {}
294
+
Foo.prototype= {
295
+
/**@param{number}x*/
296
+
bar(x) {
297
+
return x;
298
+
},
299
+
};
300
+
```
301
+
302
+
Classes are a much better way to write this code:
303
+
304
+
```js
305
+
classFoo {
306
+
/**@param{number}x*/
307
+
bar(x) {
308
+
return x;
309
+
}
310
+
}
311
+
```
312
+
266
313
#### Expando assignments of `void 0` are no longer ignored as a special case:
267
314
268
315
```js
@@ -298,42 +345,8 @@ class SharedClass2 {
298
345
}
299
346
```
300
347
301
-
#### Assigning to the `prototype` property of a function no longer makes it a constructor function:
302
-
303
-
```js
304
-
functionFoo() {}
305
-
Foo.prototype= {
306
-
/**@param{number}x*/
307
-
bar(x) {
308
-
return x;
309
-
},
310
-
};
311
-
```
312
-
313
-
Classes are a much better way to write this code.
314
-
315
-
```js
316
-
classFoo {
317
-
/**@param{number}x*/
318
-
bar(x) {
319
-
return x;
320
-
}
321
-
}
322
-
```
323
-
324
348
### CommonJS
325
349
326
-
#### Initializing exports to `undefined`:
327
-
328
-
To accommodate the pattern of initializing CommonJS exports to `undefined` (sometimes written as `void 0`) and then subsequently assigning their intended values, when CommonJS exports have multiple assignments and an initial assignment of `undefined`, the `undefined` is ignored when determining the type of the export.
329
-
330
-
```js
331
-
exports.foo=exports.bar=void0;
332
-
// Later in the same file...
333
-
exports.foo=123// Exported type is `123`
334
-
exports.bar="abc"// Exported type is `"abc"`
335
-
```
336
-
337
350
#### Mixing module.exports assignments
338
351
339
352
Corsa does not permit CommonJS modules to mix assignments to the full `module.exports` with assignments to `module.exports.xxx` properties. A CommonJS module must either contain an assignment to `module.exports` or a series of assignments to `module.exports.xxx` properties, but not both.
0 commit comments