-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Description
Description
Typescript compilation emit a new import for an inferred type with a wrong path while the type is already imported before at the top of the file.
TypeScript Version: 3.0.3
Search Terms:
- declaration path
Code
import { emailTemplates } from './utils/email';
const defaultOptions = {
tokenSecret: 'secret',
tokenConfigs: {
accessToken: {
expiresIn: '90m',
},
refreshToken: {
expiresIn: '7d',
},
},
// Type is inferred here
emailTemplates,
userObjectSanitizer: (user: User) => user,
sendMail,
siteUrl: 'http://localhost:3000',
};Expected behavior:
// ...
import { EmailTemplateType } from './types/email-template-type';
declare const defaultOptions: {
tokenSecret: string;
tokenConfigs: {
accessToken: {
expiresIn: string;
};
refreshToken: {
expiresIn: string;
};
};
emailTemplates: EmailTemplateType;
userObjectSanitizer: (user: User) => User;
sendMail: (mail: object) => Promise<void>;
siteUrl: string;
};
// ...
Actual behavior:
// ...
import { EmailTemplateType } from './types/email-template-type';
declare const defaultOptions: {
tokenSecret: string;
tokenConfigs: {
accessToken: {
expiresIn: string;
};
refreshToken: {
expiresIn: string;
};
};
emailTemplates: import("@accounts/server/src/types/email-templates-type").EmailTemplatesType;
userObjectSanitizer: (user: User) => User;
sendMail: (mail: object) => Promise<void>;
siteUrl: string;
};
// ...
How to reproduce:
- git clone https://github.com/accounts-js/accounts
- cd accounts
- Setup the repo, run
yarn - Setup lerna, run
yarn setup - Then compile with tsc, run
yarn compile - Open
packages/server/lib/accounts-server.d.tsto see the error
Happy to provide more infos if needed thanks :)
Metadata
Metadata
Assignees
Labels
No labels