-
Notifications
You must be signed in to change notification settings - Fork 64
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
Duplicate declarations are generated #115
Comments
@slavafomin Since i don't see activity and i am just passing by you can check this implementation for this feature https://github.com/rxdi/dts-merge npm i -g @rxdi/dts-merge rxdi-merge --name @yournamespace --project . --out dist/index.d.ts |
@Stradivario I'm not able to try this out, but thanks nevertheless. This should be used on source files, right? |
EDIT: As far as i can see now it is using generated .map files :( and i think what you need to do is imposible since you can have same imports from files and if you merge them you cannot understand what is duplicated and what is not.This method by decalaring it module by module gives you freedom to export everything and declare single typo inside tsconfig.json. // @slavafomin No it is not used on source files it can create source files also but that's another case :). Example will be the follow: You have these files import { TestClass2 } from './test2';
export const test = 'proba';
export class Test {
execute1(proba: string) {
return new TestClass2();
}
}
export class Test2 {
execute1(proba: string) {}
}
export class Test3 {
execute1(proba: string) {}
}
test2.ts export class TestClass2 {
execute3(proba: string) {}
} When you execute rxdi-merge --name @test --project . --out dist/index.d.ts You will get the following output from these generated files declare module '@test/test2' {
export class TestClass2 {
execute3(proba: string): void;
}
}
declare module '@test' {
import { TestClass2 } from '@test/test2';
export const test = "proba";
export class Test {
execute1(proba: string): TestClass2;
}
export class Test2 {
execute1(proba: string): void;
}
export class Test3 {
execute1(proba: string): void;
}
} P.S. You can check also this example decentralized ;) Typings: https://cloudflare-ipfs.com/ipfs/QmVJwuFteVjYwuEQtK95bptVsst9m2WcynSmeXMMXewQrZ Minified module: https://cloudflare-ipfs.com/ipfs/QmWNVV6G5fAgZRJsk5U9x3A3DKLrn592GByXd5pyXyzuP6 If you want to install it and test it you can try: npm i @rxdi/core -g rxdi i Qmd4tCCcVpQQftMMU1fxQXPJeR3xwyE9qNzrLXp2xbSrYR Usage import { Test1, Test2, Test3, TestClass2 } from '@test'; P.S2 I just check and i am using the same source like in this repository with little modifications Regards, |
Hello!
Thank you for this promising tool!
However, I've tried to use it in order to create a single bundle for my library's type definitions, but I'm getting a single
.d.ts
file, where definition for the same class is repeated 12 times.Also, there are multiple modules like this:
declare module "src/foo/bar"
. Is there a way to merge all modules into a single one and avoid duplication? Could you elaborate on what could cause the duplication in the first place?Thanks!
The text was updated successfully, but these errors were encountered: