TypeScript Version: 3.1.1
Search Terms:
allowJS Implicitly has an 'any' type
TSConfig
{
"compilerOptions": {
"allowJs": true,
"module": "commonjs",
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"strict": true,
"target": "es2017",
"lib": [
"dom",
"es2017",
"es2018",
"esnext"
],
}
I am importing this JS file:
module.exports = {
development: {
username: "postgres",
password: "",
database: "development_database",
host: "127.0.0.1",
dialect: "postgres"
},
test: {
username: "postgres",
password: "",
database: "test_database",
host: "127.0.0.1",
dialect: "postgres",
logging: false
}
}
like this:
import { Sequelize } from 'sequelize-typescript'
import * as sequelizeConfig from '../db/config'
const config = sequelizeConfig[process.env.NODE_ENV || 'development']
...
...
Expected behavior:
On 3.0.3 this compiles fine with no issues.
Actual behavior:
On 3.1.1 I get this error:
Element implicitly has an 'any' type because type '{ development: { username: string; password: string; database: string; host: string; dialect: string; }; test: { username: string; password: string; database: string; host: string; dialect: string; logging: boolean; }; }' has no index signature.
7 const config = sequelizeConfig[process.env.NODE_ENV || 'development']
I'm new to Typescript, but shouldn't allowJS: true prevent this scenario?
TypeScript Version: 3.1.1
Search Terms:
allowJS Implicitly has an 'any' type
TSConfig
I am importing this JS file:
like this:
Expected behavior:
On 3.0.3 this compiles fine with no issues.
Actual behavior:
On 3.1.1 I get this error:
I'm new to Typescript, but shouldn't
allowJS: trueprevent this scenario?