Skip to content

Relative path reference for declaration #26439

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"
  ]
}

Activity

  1. added a commit that references this issue on Nov 2, 2018
  2. weswigham commented on Aug 13, 2019

    @weswigham
    Member

    This no longer repros in typescript 3.5. In fact, I believe it was fixed in the actual release of TS 3.1 by #26568.

  3. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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