Skip to content

Relative path reference for declaration #26439

Closed
@denl95

Description

@denl95

TypeScript Version: 3.1.0-dev.20180813
Also can be reproduced in version 3.0.1

Search Terms:
declaration, reference, lodash
Code
I was trying to migrate from 2.7.2 version to 3.0.1 and getting this behavior in 3.0.1.
Here I am using lodash:

import PropTypes from 'prop-types';
import { has, difference, entries, each, set } from 'lodash';

And after I ran tsc compiler this declaration will be generated:

/// <reference path="../../../../node_modules/@types/lodash/common/common.d.ts" />
/// <reference path="../../../../node_modules/@types/lodash/common/array.d.ts" />
/// <reference path="../../../../node_modules/@types/lodash/common/collection.d.ts" />
/// <reference path="../../../../node_modules/@types/lodash/common/date.d.ts" />
/// <reference path="../../../../node_modules/@types/lodash/common/function.d.ts" />
/// <reference path="../../../../node_modules/@types/lodash/common/lang.d.ts" />
/// <reference path="../../../../node_modules/@types/lodash/common/math.d.ts" />
/// <reference path="../../../../node_modules/@types/lodash/common/number.d.ts" />
/// <reference path="../../../../node_modules/@types/lodash/common/object.d.ts" />
/// <reference path="../../../../node_modules/@types/lodash/common/seq.d.ts" />
/// <reference path="../../../../node_modules/@types/lodash/common/string.d.ts" />
/// <reference path="../../../../node_modules/@types/lodash/common/util.d.ts" />
import PropTypes from 'prop-types';

So than I can't use this declaration in another project. Everything works good in 2.7.2 version
Here is my tsconfig.json:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "declaration": true,
    "strict": true,
    "sourceMap": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "importHelpers": true,
    "jsx": "react",
    "lib": [
      "es5",
      "es2015",
      "es6",
      "es2016",
      "dom"
    ],
    "removeComments": true,
    "preserveConstEnums": true,
    "experimentalDecorators": true,
    "rootDir": "./src",
    "outDir": "build/dist",
    "strictNullChecks": false,
    "pretty": true,
    "noErrorTruncation": true
  },
  "include": [
    "./types/global.d.ts",
    "./types/is_js.d.ts",
    "./types/redux-api-middleware.d.ts",
    "./types/moment-duration-format.d.ts",
    "./types/text-size.d.ts",
    "src/**/*.ts",
    "src/**/*.tsx"
  ],
  "exclude": [
    "node_modules",
    "**/*.spec.ts"
  ]
}

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts files

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions