Closed
Description
Related to issue #24599 , where @mhegazy specifically asks to create a separate ticket with more information when using latest typescript@next (^3.0.0-dev.20180630")
Imports get's node_modules
added, which breaks Library conventions.
It's easy to replicate.
import ex. a library like @material-ui, which you have as a dependency.
Using a tsconfig file like
"compilerOptions": {
"baseUrl": "./",
"rootDir": "src",
"outDir": "dist",
"declaration": true,
"module": "commonjs",
"target": "es5",
"lib": [ "es6", "dom" ],
"sourceMap": true,
"moduleResolution": "node",
"jsx": "react",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": false,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": false,
},
"exclude": [
"node_modules"
]
Will take a .tsx file like:
import * as React from 'react';
import { WithStyles } from '@material-ui/core';
import { withStyles } from '@material-ui/core/styles';
import formBasicsStyles from "./../../../theme/formBasics";
interface IFileUploadProps extends WithStyles{
}
export const FileUpload = withStyles(formBasicsStyles)(
class extends React.Component<IFileUploadProps> {
constructor(props: IFileUploadProps){
super(props);
}
public render() {
const { classes } = this.props;
return (
<div>
</div>
);
}
}
);
And output a d.ts file like:
import * as React from 'react';
import { WithStyles } from '@material-ui/core';
interface IFileUploadProps extends WithStyles {
}
export declare const FileUpload: React.ComponentType<import("node_modules/@material-ui/core").Overwrite<IFileUploadProps, import("node_modules/@material-ui/core/styles/withStyles").StyledComponentProps<string>>>;
export {};
In the output d.ts file one would
expect: import("@material-ui...
.
but result is: import("node_modules/@material-ui...
Hope information is sufficient.