This is similar to the issue discussed in How can I enable modules without .d.ts type definitions?
Although VS Code stopped showing errors after adding those files, attempting to compile using gulp
still resulted in an error message on the console.
(Interestingly, today I noticed that VS code stopped displaying most of the errors)
Inside ./src/dts/
, I have:
dyo.d.ts
declare module 'dyo';
tsconfig.json
{
"compilerOptions": {
"lib": ["dom", "es2016", "es2017.object"],
"rootDir": "src",
"target": "es5",
"outDir": "build",
"moduleResolution": "node",
//"noImplicitAny": false,
"removeComments": true,
"typeRoots": [
"src/dts",
"node_modules/@types"
]
},
"exclude": [
"node_modules"
],
"files": [
"./src/dts/dyo.d.ts",
"./src/dts/randomseed.d.ts"
]
}
The error received is:
error TS7016: Could not find a declaration file for module 'dyo'. '/mediatest/node_modules/dyo/dist/dyo.umd.js' implicitly has an 'any' type. Try
npm install @types/dyo
if it exists or add a new declaration (.d.ts) file containingdeclare module 'dyo';
I am importing the modules like this:
import { h, render } from 'dyo'
import * as _rng from 'random-seed'
The second module is also not functioning properly.
A previous suggestion was to include the files
property and another source recommended including the typeRoots
property, but neither solution seems to be resolving the issue.
Apologies for the multiple inquiries related to TypeScript on Stack Overflow.