Closed
Description
TypeScript Version: 3.0.0-dev.20180601
Search Terms: declaration import types
Code
src/one/two/export.ts:
import * as CSS from 'csstype';
export const use = (f: CSS.Properties['fontWeight']) => f;
src/one/two/consumer.ts:
import { use } from "./export";
export const asdf = use ;
Expected behavior:
consumer.d.ts has something like
export declare const asdf: (f: import("csstype/index").FontWeightProperty) => import("csstype/index").FontWeightProperty;
Actual behavior:
It has relative paths to node_modules, based on the source file's location at compile time. This places an assumption on the location of the d.ts file when it's consumed externally.
export declare const asdf: (f: import("../../../node_modules/csstype/index").FontWeightProperty) => import("../../../node_modules/csstype/index").FontWeightProperty;
Playground Link: N/A
Related Issues: #24556, but csstype does specify a types key in package.json