-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
@typesRelates to working with .d.ts files (declaration/definition files) from DefinitelyTypedRelates to working with .d.ts files (declaration/definition files) from DefinitelyTypedExternalRelates to another program, environment, or user action which we cannot control.Relates to another program, environment, or user action which we cannot control.
Description
TypeScript Version: 2.0.2
I previously installed typescript declarations using
npm install @types/lodash
I have the following in my tsconfig.json
{
"compilerOptions": {
"module": "amd",
"target": "es5",
"noImplicitAny": false,
"moduleResolution":"node", // using this lets us have rootDirs resolve stuff like moment with "./moment"
"rootDirs": ["node_modules","./", "node_modules/@types"],
"sourceMap": false,
"newLine": "LF",
"declaration": true,
//"allowSyntheticDefaultImports": true
//"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"baseUrl": ".",
"lib":["es5","es2015.promise"],
"paths": {
"N/*": [
"node_modules/@hitc/netsuite-types/N/*"
]
}
},
//"include": ["EC_Logger.ts", "DataAccess/*.ts"]
"include": ["EC_Logger.ts"]
//"exclude": ["node_modules", "test", "declarations"]
}
Then in EC_Logger.ts
I have the following import
import * as _ from "./lodash"
results in
======== Type reference directive 'lodash' was successfully resolved to '/home/shawn/s/netsuite-fasttrack-toolkit-ss2/node_modules/@types/lodash/index.d.ts', primary: true. ========
EC_Logger.ts(8,20): error TS2306: File '/home/shawn/s/netsuite-fasttrack-toolkit-ss2/node_modules/@types/lodash/index.d.ts' is not a module.
If I change the import to be non relative, it resolves successfully and to the same physical file and compiles without error:
import * as _ from "lodash"
results in the following, and no compile error.
======== Type reference directive 'lodash' was successfully resolved to '/home/shawn/s/netsuite-fasttrack-toolkit-ss2/node_modules/@types/lodash/index.d.ts', primary: true. ========
Expected behavior:
The module should be recognized as a a valid module in both forms of import statements since it resolves to the same exact file?
Actual behavior:
'file is not a module' error when using relative path ./lodash
, no error if using plain lodash
Metadata
Metadata
Assignees
Labels
@typesRelates to working with .d.ts files (declaration/definition files) from DefinitelyTypedRelates to working with .d.ts files (declaration/definition files) from DefinitelyTypedExternalRelates to another program, environment, or user action which we cannot control.Relates to another program, environment, or user action which we cannot control.