-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
This issues has popped up intermittently in my codebase over the past few months, so it is influenced by build options and should be able to be workaround somehow, but it's also pretty unnecessary and very easy to fix.
** Problem **
Without a types property, the compile fails eventually when tendermint is trying to import create-hash with
Could not find a declaration file for module 'create-hash'.
because tsc ends up compiling the wrong src version. You can see it in the module resolution: note the 2nd resolution where the resolve looks for types
======== Resolving module '@tendermint/sig' from 'C:/src/TheCoin/node_modules/@ceramicnetwork/blockchain-utils-linking/lib/cosmos.d.ts'. ========
Explicitly specified module resolution kind: 'NodeJs'.
'baseUrl' option is set to 'C:/src/TheCoin/libs/IDX/src', using this value to resolve non-relative module name '@tendermint/sig'.
Resolving module name '@tendermint/sig' relative to base url 'C:/src/TheCoin/libs/IDX/src' - 'C:/src/TheCoin/libs/IDX/src/@tendermint/sig'.
Loading module as file / folder, candidate module location 'C:/src/TheCoin/libs/IDX/src/@tendermint/sig', target file type 'TypeScript'.
Loading module '@tendermint/sig' from 'node_modules' folder, target file type 'TypeScript'.
Directory 'C:/src/TheCoin/node_modules/@ceramicnetwork/blockchain-utils-linking/lib/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'tendermint__sig'
Directory 'C:/src/TheCoin/node_modules/@ceramicnetwork/blockchain-utils-linking/node_modules/@types' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'tendermint__sig'
Directory 'C:/src/TheCoin/node_modules/@ceramicnetwork/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'tendermint__sig'
Found 'package.json' at 'C:/src/TheCoin/node_modules/@tendermint/sig/package.json'.
'package.json' does not have a 'typesVersions' field.
File 'C:/src/TheCoin/node_modules/@tendermint/sig.ts' does not exist.
File 'C:/src/TheCoin/node_modules/@tendermint/sig.tsx' does not exist.
File 'C:/src/TheCoin/node_modules/@tendermint/sig.d.ts' does not exist.
'package.json' does not have a 'typings' field.
'package.json' does not have a 'types' field.
'package.json' has 'main' field 'index.js' that references 'C:/src/TheCoin/node_modules/@tendermint/sig/index.js'.
File 'C:/src/TheCoin/node_modules/@tendermint/sig/index.js' exist - use it as a name resolution result.
File 'C:/src/TheCoin/node_modules/@tendermint/sig/index.js' has an unsupported extension, so skipping it.
Loading module as file / folder, candidate module location 'C:/src/TheCoin/node_modules/@tendermint/sig/index.js', target file type 'TypeScript'.
File 'C:/src/TheCoin/node_modules/@tendermint/sig/index.js.ts' does not exist.
File 'C:/src/TheCoin/node_modules/@tendermint/sig/index.js.tsx' does not exist.
File 'C:/src/TheCoin/node_modules/@tendermint/sig/index.js.d.ts' does not exist.
File name 'C:/src/TheCoin/node_modules/@tendermint/sig/index.js' has a '.js' extension - stripping it.
File 'C:/src/TheCoin/node_modules/@tendermint/sig/index.ts' exist - use it as a name resolution result.
Resolving real path for 'C:/src/TheCoin/node_modules/@tendermint/sig/index.ts', result 'C:/src/TheCoin/node_modules/@tendermint/sig/index.ts'.
** Workarounds **
Note: --skipLibCheck does not fix this for me.
in .d.ts file:
declare module 'create-hash';
** Fix **
Adding types folder to package.json removes the error, and gives the following resolution stack (note that the resolution finds stops after it finds the .d.ts file
======== Resolving module '@tendermint/sig' from 'C:/src/TheCoin/node_modules/@ceramicnetwork/blockchain-utils-linking/lib/cosmos.d.ts'. ========
Explicitly specified module resolution kind: 'NodeJs'.
Loading module '@tendermint/sig' from 'node_modules' folder, target file type 'TypeScript'.
Directory 'C:/src/TheCoin/node_modules/@ceramicnetwork/blockchain-utils-linking/lib/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'tendermint__sig'
Directory 'C:/src/TheCoin/node_modules/@ceramicnetwork/blockchain-utils-linking/node_modules/@types' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'tendermint__sig'
Directory 'C:/src/TheCoin/node_modules/@ceramicnetwork/node_modules' does not exist, skipping all lookups in it.
Scoped package detected, looking in 'tendermint__sig'
Found 'package.json' at 'C:/src/TheCoin/node_modules/@tendermint/sig/package.json'.
'package.json' does not have a 'typesVersions' field.
File 'C:/src/TheCoin/node_modules/@tendermint/sig.ts' does not exist.
File 'C:/src/TheCoin/node_modules/@tendermint/sig.tsx' does not exist.
File 'C:/src/TheCoin/node_modules/@tendermint/sig.d.ts' does not exist.
'package.json' does not have a 'typings' field.
'package.json' has 'types' field 'index.d.ts' that references 'C:/src/TheCoin/node_modules/@tendermint/sig/index.d.ts'.
File 'C:/src/TheCoin/node_modules/@tendermint/sig/index.d.ts' exist - use it as a name resolution result.
Resolving real path for 'C:/src/TheCoin/node_modules/@tendermint/sig/index.d.ts', result 'C:/src/TheCoin/node_modules/@tendermint/sig/index.d.ts'.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels