fix: types field no longer required in package.json
#2462
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
jsiicompiler used to require thatpackage.json#typeswas specified, usually set toindex.d.ts.The upstream TypeScript compiler doesn't require this, and just defaults to either
index.tsorindex.d.ts, whichever one is available.In fact, the forcing of a
"types": "index.d.ts"entry intopackage.jsonmakes compilation harder:If user code happens to import the package root directory (via
import { Symbol } from '../..'or the like) TypeScript module resolution will find thepackage.json, read the"types"entry from it, and add that to the source list.This will then lead to
index.d.tsto be added to the set of source files, instead ofindex.ts.That will then most likely lead to the error:
Relieve the restriction on the presence of this field. It's unnecessary, and its presence messes up compilation in some cases.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.