Open umrashrf opened 5 years ago
This was because ITypescript resolve models by itself, not by the typescript library. I changed the code, and the issue may be resolved. Could you check whether this issue is resolved please?
I figured out that the incomplete parsing process of tsconfig.json file was the cause. I mistakenly believed that the function ts.readConfigFile
that is currently ITypescript called for parsing configuration can convert string values into Enum values of typescript library. In a couple of minutes, I'll upload a version that the function call is replaced with ts.getParsedCommandLineOfConfigFile
, which correctly handles the issue.
Note: The codes that you faced errors are tested successfully with TS 3.3, Node 10.13.0, with compilerOptions
as follow ("esModuleInterop" should be true):
{
"compileOnSave": true,
"compilerOptions": {
"lib": [
"es2017",
"dom"
],
"outDir": "./build",
"target": "es6",
"module": "commonjs",
"skipLibCheck": true, /* Try to remove it */
"noImplicitAny": false,
"allowJs": true,
"esModuleInterop": true
}
}
Try to put a comment in the tsconfig.json and
its
will complain. I would agree that it's not valid JSON file butnpm/typescript
can parse itAfter fixing the comments, I see this:
import mongoose from 'mongoose'