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
The TypeScript typings for the yaml package fail to compile unless the downlevelIteration=true compiler option is enabled in the consuming project's tsconfig.json file.
To Reproduce
Attempt to compile some TypeScript code that does import * as yaml from 'yaml'; with downlevelIteration=false.
The error messages look like:
[typescript] Error: yaml/dist/nodes/Collection.d.ts:56:14 - (TS2569) Type 'Iterable<unknown>' is
not an array type or a string type. Use compiler option '--downlevelIteration' to
allow iterating of iterators.
The problem lines look like:
yaml/dist/nodes/Collection.d.ts
/**
* Removes a value from the collection.
* @returns `true` if the item was found and removed.
*/
deleteIn([key, ...rest]: Iterable<unknown>): boolean;
^^^^^^^^^^^^^^
Expected behaviour
We have this setting disabled in some of our projects that target ES5. The reason is that performance is very important, and transpilation of downlevelIteration was considered too expensive for those projects. Iterators are a nice language feature, but to ensure broadest compatibility with all potential consumers, a library package such as yaml should not rely on this feature in its API.
Note that I'm not insisting for yaml/**/*.js to adopt a particular transpilation strategy. This is merely a request that the .d.ts files should be declared in a way that will compile without errors.
Versions (please complete the following information):
Environment: Node v14.15.4
yaml: ~2.0.0-8
TypeScript compiler: 4.2.4
The text was updated successfully, but these errors were encountered:
Describe the bug
The TypeScript typings for the
yaml
package fail to compile unless thedownlevelIteration=true
compiler option is enabled in the consuming project'stsconfig.json
file.To Reproduce
Attempt to compile some TypeScript code that does
import * as yaml from 'yaml';
withdownlevelIteration=false
.The error messages look like:
The problem lines look like:
yaml/dist/nodes/Collection.d.ts
Expected behaviour
We have this setting disabled in some of our projects that target ES5. The reason is that performance is very important, and transpilation of
downlevelIteration
was considered too expensive for those projects. Iterators are a nice language feature, but to ensure broadest compatibility with all potential consumers, a library package such asyaml
should not rely on this feature in its API.Note that I'm not insisting for
yaml/**/*.js
to adopt a particular transpilation strategy. This is merely a request that the.d.ts
files should be declared in a way that will compile without errors.Versions (please complete the following information):
yaml
: ~2.0.0-8The text was updated successfully, but these errors were encountered: