mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
At the moment, this snippet:
```ts
const spawnArgs: ReadonlyArray<string> = ['foo', 'bar'];
spawn('foobar', spawnArgs);
```
fails with:
```
Argument of type 'ReadonlyArray<string>' is not assignable to parameter of type 'string[] | undefined'.
Type 'ReadonlyArray<string>' is not assignable to type 'string[]'.
```
Looking at https://github.com/nodejs/node/blob/master/lib/child_process.js#L514-L535 and https://github.com/nodejs/node/blob/master/lib/internal/child_process.js#L286, it _looks_ like there is no mutation of the array. I am no expert so I'd be happy to be proven wrong, I just couldn't find sufficient evidence that a `ReadonlyArray` wouldn't be fine.
This is not a breaking change because passing a `string[]` is still valid.
|
||
|---|---|---|
| .. | ||
| index.d.ts | ||
| node-tests.ts | ||
| tsconfig.json | ||
| tslint.json | ||