Skip to content

Commit 8e3f72a

Browse files
ahejlsbergCopilot
andauthored
Update CHANGES.md to reflect #2513 (#2541)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 24a6cf2 commit 8e3f72a

1 file changed

Lines changed: 11 additions & 41 deletions

File tree

CHANGES.md

Lines changed: 11 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,6 @@ f.called = false;
6969
| Single-property access `require` | `var readFile = require('fs').readFile` | `var { readFile } = require('fs')` | |
7070
| Aliasing of `module.exports` | <pre><code>var mod = module.exports</code><br/><code>mod.x = 1</code></pre> | `module.exports.x = 1` | |
7171

72-
## Features yet to be implemented
73-
74-
`Object.defineProperty` for CommonJS exports and expandos. The compiler treats this as an alternate to the usual assignment syntax:
75-
76-
```js
77-
function f() {}
78-
Object.defineProperty(f, "p", { value: 1, writable: true });
79-
```
80-
8172
# Component-Level Changes
8273

8374
## Scanner
@@ -113,7 +104,7 @@ Corsa no longer parses the following JSDoc tags with a specific node type. They
113104

114105
### Miscellaneous
115106

116-
#### When `"strict": false`, Corsa no longer allows omitting arguments for parameters with type `undefined`, `unknown`, or `any`:
107+
#### With `"strict": false`, Corsa no longer allows omitting arguments for parameters with type `undefined`, `unknown`, or `any`:
117108

118109
```js
119110
/** @param {unknown} x */
@@ -143,8 +134,7 @@ var x = { a: 1, b: 2 };
143134
var entries = Object.entries(x);
144135
```
145136

146-
In Strada, `entries: Array<[string, any]>`.
147-
In Corsa it has type `Array<[string, unknown]>`, the same as in TypeScript.
137+
In Strada, `entries: Array<[string, any]>`. In Corsa it has type `Array<[string, unknown]>`, the same as in TypeScript.
148138

149139
#### Values are no longer resolved as types in JSDoc type positions.
150140

@@ -240,14 +230,13 @@ This is identical to the TypeScript rule.
240230

241231
#### Error messages on async functions that incorrectly return non-Promises now use the same error as TS.
242232

243-
#### `@typedef` and `@callback` in a class body are no longer accessible outside the class.
233+
#### `@typedef` and `@callback` in a class body are hoisted outside the class.
244234

245-
They must be moved outside the class to use them outside the class.
235+
This means the declarations are accessible outside the class and may conflict with similarly named declarations in the outer scope.
246236

247237
#### `@class` or `@constructor` does not make a function into a constructor function.
248238

249-
Corsa ignores `@class` and `@constructor`.
250-
This makes a difference on a function without this-property assignments or associated prototype-function assignments.
239+
Corsa ignores `@class` and `@constructor`. This makes a difference on a function without this-property assignments or associated prototype-function assignments.
251240

252241
#### `@param` tags now apply to at most one function.
253242

@@ -349,32 +338,13 @@ Although classes are a much better way to write this code.
349338

350339
### CommonJS
351340

352-
#### Chained exports no longer work:
353-
354-
```js
355-
exports.x = exports.y = 12;
356-
```
357-
358-
Now only exports `x`, not `y` as well.
359-
360-
#### Exporting `void 0` is no longer ignored as a special case:
361-
362-
```js
363-
exports.x = void 0;
364-
// several lines later...
365-
exports.x = theRealExport;
366-
```
367-
368-
This exports `x: undefined` not `x: typeof theRealExport`.
369-
370-
#### Property access on `require` no longer imports a single property from a module:
371-
372-
```js
373-
const x = require("y").x;
374-
```
341+
#### Initializing exports to `undefined`:
375342

376-
If you can't configure your package to use ESM syntax, you can use destructuring instead:
343+
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.
377344

378345
```js
379-
const { x } = require("y");
346+
exports.foo = exports.bar = void 0;
347+
// Later in the same file...
348+
exports.foo = 123 // Exported type is `123`
349+
exports.bar = "abc" // Exported type is `"abc"`
380350
```

0 commit comments

Comments
 (0)