Skip to content

Relative path reference for declaration #26439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
denl95 opened this issue Aug 14, 2018 · 1 comment
Closed

Relative path reference for declaration #26439

denl95 opened this issue Aug 14, 2018 · 1 comment
Assignees
Labels
Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files

Comments

@denl95
Copy link

denl95 commented Aug 14, 2018

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"
  ]
}
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 3.1 milestone Aug 15, 2018
@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files labels Aug 15, 2018
Bobris added a commit to bobril/bbcore that referenced this issue Nov 2, 2018
- Test command has now -d parameter which can define where to dump build files for testing

### Changed

- Default TypeScript is now 3.1.6

### Fixed

- detection of triple slash references (TypeScript is still somewhat buggy microsoft/TypeScript#26439)
@weswigham weswigham added Fix Available A PR has been opened for this issue and removed Fix Available A PR has been opened for this issue labels Aug 13, 2019
@weswigham
Copy link
Member

weswigham commented Aug 13, 2019

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.

@weswigham weswigham removed this from the TypeScript 3.6.1 milestone Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files
Projects
None yet
Development

No branches or pull requests

4 participants