plantain-00 / schema-based-json-editor

A reactjs and vuejs component of schema based json editor.
MIT License
168 stars 38 forks source link

Building tsc projects with `noImplicitAny` can't find lodash types. #7

Open knowuh opened 6 years ago

knowuh commented 6 years ago

Hello,

Thank you for schema-based-json . It's exactly what I need at the moment.

I ran into something when using strict noImplicitAny rules in tsconfig.js. I can work around this, but thought I should bring it up, incase it is something which you can address in future releases.

I hope this is enough information to help you.

Cheers!

Version(if relevant): 1.0.0

7.2.1

Environment(if relevant):

webpack 3.10 awesome-typescript-loader 3.1 typescript 2.5.2

Code(if relevant):

→ schema-based-json-editor/dist/index.d.ts:

import * as toNumber from "lodash.tonumber";
import * as toInteger from "lodash.tointeger";

→ tsconfig.json

{
  "compilerOptions": {
    "outDir": "./dist",
    "sourceMap": true,
    "declaration": true,
    "noImplicitAny": true,   ⬅
    "module": "commonjs",
    "moduleResolution": "node",
    "target": "es5",
    "lib": ["es6", "dom"],
    "jsx": "react",
    "strictNullChecks": true
  },
  "include": [ "src/**/*"]
}
    webpack

Expected:

Build without errors

Actual:


ERROR in [at-loader] ./node_modules/schema-based-json-editor/dist/index.d.ts:1:27
    TS7016: Could not find a declaration file for module 'lodash.tonumber'. '/Users/npaessel/lab/cc/model-feedback/node_modules/lodash.tonumber/index.js' implicitly has an 'any' type.
  Try `npm install @types/lodash.tonumber` if it exists or add a new declaration (.d.ts) file containing `declare module 'lodash.tonumber';`

ERROR in [at-loader] ./node_modules/schema-based-json-editor/dist/index.d.ts:2:28
    TS7016: Could not find a declaration file for module 'lodash.tointeger'. '/Users/npaessel/lab/cc/model-feedback/node_modules/lodash.tointeger/index.js' implicitly has an 'any' type.
  Try `npm install @types/lodash.tointeger` if it exists or add a new declaration (.d.ts) file containing `declare module 'lodash.tointeger';`
plantain-00 commented 6 years ago

v7.2.4 should fix this issue