-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Idea: Can declaration emit synthesize imports? #44044
Comments
@weswigham I'm pretty confident that this is a dup and I wouldn't be surprised to learn you already have a PR. 😉 |
I remarked on it back when I first added support for emitting them: #24071 (comment) but I don't think I have a branch. At least not anymore, anyway. |
@RyanCavanaugh The generated TypeScript declaration file (.d.ts) repeats similar structures for each object, leading to excessive duplication. export default {
"1": {
"text": {
"path": "assets\\program-data\\1\\lesson1\\data.json",
"abbreviatedPath": "1\\lesson1\\data.json",
"md5": "13d43bf648d4c8011eaf9c90089cbdcdfa54bbc2c904d1955dbdc45f9c2c2c53",
"fileName": "data.json",
"volume": "1",
"lesson": "lesson1",
"interface": {
"id": 23659,
"fileName": "data.json",
"time": "2024-09-05T22:22:10.332+08:00",
"url": "https://cdn.z.wiki/autoupload/20240905/IbtV/data.json",
"uid": "@new-concept-english/source",
"contentType": "application/octet-stream",
"shareCode": null,
"shareExpireDate": null,
"size": "2.61 KB",
"md5": "56ecf0cd0141672e98494dd896ed08fd"
}
},
"additional": {
"md5": "13d43bf648d4c8011eaf9c90089cbdcdfa54bbc2c904d1955dbdc45f9c2c2c53",
"lesson": 1,
"title": "Lesson 1 Excuse me! 对不起!"
},
"tapeEnglish": {
"mp3": {
"path": "assets\\program-data\\1\\lesson1\\tape-english\\course.mp3",
"abbreviatedPath": "1\\lesson1\\tape-english\\course.mp3",
"md5": "f2f5683bfaf749f3862e1e0723876ae8c00daad8b26c7469013260a0dc44ebcb",
"fileName": "course.mp3",
"volume": "1",
"lesson": "lesson1",
"interface": {
"id": 23450,
"fileName": "course.mp3",
"time": "2024-09-03T21:08:13.513+08:00",
"url": "https://cdn.z.wiki/autoupload/20240903/KB7o/course.mp3",
"uid": "@new-concept-english/source",
"contentType": "application/octet-stream",
"shareCode": null,
"shareExpireDate": null,
"size": "645.94 KB"
}
},
"lrc": {
"path": "assets\\program-data\\1\\lesson1\\tape-english\\course.lrc",
"abbreviatedPath": "1\\lesson1\\tape-english\\course.lrc",
"md5": "97dc5f3b2a84a395b58c99144382c3dada351727c41e8043a88487bfe90f8940",
"fileName": "course.lrc",
"volume": "1",
"lesson": "lesson1",
"interface": {
"id": 23449,
"fileName": "course.lrc",
"time": "2024-09-03T21:08:13.977+08:00",
"url": "https://cdn.z.wiki/autoupload/20240903/kARy/course.lrc",
"uid": "@new-concept-english/source",
"contentType": "application/octet-stream",
"shareCode": null,
"shareExpireDate": null,
"size": "474 B"
}
}
},
"tapeAmericanMusic": {
"mp3": {
"path": "assets\\program-data\\1\\lesson1\\tape-american-music\\course.mp3",
"abbreviatedPath": "1\\lesson1\\tape-american-music\\course.mp3",
"md5": "670f88e3f64ed1ec205fd20596679f2d8cb955f8ef5b63c0a6f3962f4d1d34ea",
"fileName": "course.mp3",
"volume": "1",
"lesson": "lesson1",
"interface": {
"id": 23452,
"fileName": "course.mp3",
"time": "2024-09-03T21:08:16.770+08:00",
"url": "https://cdn.z.wiki/autoupload/20240903/8d2K/course.mp3",
"uid": "@new-concept-english/source",
"contentType": "application/octet-stream",
"shareCode": null,
"shareExpireDate": null,
"size": "799.94 KB"
}
},
"lrc": {
"path": "assets\\program-data\\1\\lesson1\\tape-american-music\\course.lrc",
"abbreviatedPath": "1\\lesson1\\tape-american-music\\course.lrc",
"md5": "6a07bc9eb1a5f030a63536970daefbc79c2bf7e6696fe0f383b4579d2291762a",
"fileName": "course.lrc",
"volume": "1",
"lesson": "lesson1",
"interface": {
"id": 23451,
"fileName": "course.lrc",
"time": "2024-09-03T21:08:18.305+08:00",
"url": "https://cdn.z.wiki/autoupload/20240903/IUNy/course.lrc",
"uid": "@new-concept-english/source",
"contentType": "application/octet-stream",
"shareCode": null,
"shareExpireDate": null,
"size": "456 B"
}
}
}
},
"3": {
"text": {
"path": "assets\\program-data\\1\\lesson3\\data.json",
"abbreviatedPath": "1\\lesson3\\data.json",
"md5": "6f6446a4c1d9885c203aa6f05c41c80562ab10eccbd451f25109ecffb98d6729",
"fileName": "data.json",
"volume": "1",
"lesson": "lesson3",
"interface": {
"id": 23630,
"fileName": "data.json",
"time": "2024-09-05T22:14:59.210+08:00",
"url": "https://cdn.z.wiki/autoupload/20240905/Tz9X/data.json",
"uid": "@new-concept-english/source",
"contentType": "application/octet-stream",
"shareCode": null,
"shareExpireDate": null,
"size": "3.4 KB",
"md5": "33ee8603cd566ee40e6dc9a6ea8ba8a1"
}
},
"additional": {
"md5": "6f6446a4c1d9885c203aa6f05c41c80562ab10eccbd451f25109ecffb98d6729",
"lesson": 3,
"title": "Lesson 3 Sorry, sir. 对不起,先生。"
},
"tapeEnglish": {
"mp3": {
"path": "assets\\program-data\\1\\lesson3\\tape-english\\course.mp3",
"abbreviatedPath": "1\\lesson3\\tape-english\\course.mp3",
"md5": "0ac96b790fe7904025554b45269dc09a5a56a161a15414df914958a3fb340753",
"fileName": "course.mp3",
"volume": "1",
"lesson": "lesson3",
"interface": {
"id": 23317,
"fileName": "course.mp3",
"time": "2024-09-03T21:06:04.677+08:00",
"url": "https://cdn.z.wiki/autoupload/20240903/wcUC/course.mp3",
"uid": "@new-concept-english/source",
"contentType": "application/octet-stream",
"shareCode": null,
"shareExpireDate": null,
"size": "1.06 MB"
}
},
"lrc": {
"path": "assets\\program-data\\1\\lesson3\\tape-english\\course.lrc",
"abbreviatedPath": "1\\lesson3\\tape-english\\course.lrc",
"md5": "4728e26689eba1b5fb42c33760e532426301e54343704ae69c30068cb2d04a32",
"fileName": "course.lrc",
"volume": "1",
"lesson": "lesson3",
"interface": {
"id": 23318,
"fileName": "course.lrc",
"time": "2024-09-03T21:06:04.678+08:00",
"url": "https://cdn.z.wiki/autoupload/20240903/ck3S/course.lrc",
"uid": "@new-concept-english/source",
"contentType": "application/octet-stream",
"shareCode": null,
"shareExpireDate": null,
"size": "676 B"
}
}
},
"tapeAmericanMusic": {
"mp3": {
"path": "assets\\program-data\\1\\lesson3\\tape-american-music\\course.mp3",
"abbreviatedPath": "1\\lesson3\\tape-american-music\\course.mp3",
"md5": "b1f3dc757cda97a19960bf52e1df661ad93645b9f3f35dbf7fca0e1551050e94",
"fileName": "course.mp3",
"volume": "1",
"lesson": "lesson3",
"interface": {
"id": 23320,
"fileName": "course.mp3",
"time": "2024-09-03T21:06:06.681+08:00",
"url": "https://cdn.z.wiki/autoupload/20240903/CytW/course.mp3",
"uid": "@new-concept-english/source",
"contentType": "application/octet-stream",
"shareCode": null,
"shareExpireDate": null,
"size": "1.13 MB"
}
},
"lrc": {
"path": "assets\\program-data\\1\\lesson3\\tape-american-music\\course.lrc",
"abbreviatedPath": "1\\lesson3\\tape-american-music\\course.lrc",
"md5": "83b94c8bdb3bc463856aa465fc3510c43461ea343318e57586ca98759373f8a1",
"fileName": "course.lrc",
"volume": "1",
"lesson": "lesson3",
"interface": {
"id": 23319,
"fileName": "course.lrc",
"time": "2024-09-03T21:06:05.807+08:00",
"url": "https://cdn.z.wiki/autoupload/20240903/4XQj/course.lrc",
"uid": "@new-concept-english/source",
"contentType": "application/octet-stream",
"shareCode": null,
"shareExpireDate": null,
"size": "658 B"
}
}
}
},
} Generated d.ts declare const _default: {
"1": {
text: {
path: string;
abbreviatedPath: string;
md5: string;
fileName: string;
volume: string;
lesson: string;
interface: {
id: number;
fileName: string;
time: string;
url: string;
uid: string;
contentType: string;
shareCode: null;
shareExpireDate: null;
size: string;
md5: string;
};
};
additional: {
md5: string;
lesson: number;
title: string;
};
tapeEnglish: {
mp3: {
path: string;
abbreviatedPath: string;
md5: string;
fileName: string;
volume: string;
lesson: string;
interface: {
id: number;
fileName: string;
time: string;
url: string;
uid: string;
contentType: string;
shareCode: null;
shareExpireDate: null;
size: string;
};
};
lrc: {
path: string;
abbreviatedPath: string;
md5: string;
fileName: string;
volume: string;
lesson: string;
interface: {
id: number;
fileName: string;
time: string;
url: string;
uid: string;
contentType: string;
shareCode: null;
shareExpireDate: null;
size: string;
};
};
};
tapeAmericanMusic: {
mp3: {
path: string;
abbreviatedPath: string;
md5: string;
fileName: string;
volume: string;
lesson: string;
interface: {
id: number;
fileName: string;
time: string;
url: string;
uid: string;
contentType: string;
shareCode: null;
shareExpireDate: null;
size: string;
};
};
lrc: {
path: string;
abbreviatedPath: string;
md5: string;
fileName: string;
volume: string;
lesson: string;
interface: {
id: number;
fileName: string;
time: string;
url: string;
uid: string;
contentType: string;
shareCode: null;
shareExpireDate: null;
size: string;
};
};
};
};
"3": {
text: {
path: string;
abbreviatedPath: string;
md5: string;
fileName: string;
volume: string;
lesson: string;
interface: {
id: number;
fileName: string;
time: string;
url: string;
uid: string;
contentType: string;
shareCode: null;
shareExpireDate: null;
size: string;
md5: string;
};
};
additional: {
md5: string;
lesson: number;
title: string;
};
tapeEnglish: {
mp3: {
path: string;
abbreviatedPath: string;
md5: string;
fileName: string;
volume: string;
lesson: string;
interface: {
id: number;
fileName: string;
time: string;
url: string;
uid: string;
contentType: string;
shareCode: null;
shareExpireDate: null;
size: string;
};
};
lrc: {
path: string;
abbreviatedPath: string;
md5: string;
fileName: string;
volume: string;
lesson: string;
interface: {
id: number;
fileName: string;
time: string;
url: string;
uid: string;
contentType: string;
shareCode: null;
shareExpireDate: null;
size: string;
};
};
};
tapeAmericanMusic: {
mp3: {
path: string;
abbreviatedPath: string;
md5: string;
fileName: string;
volume: string;
lesson: string;
interface: {
id: number;
fileName: string;
time: string;
url: string;
uid: string;
contentType: string;
shareCode: null;
shareExpireDate: null;
size: string;
};
};
lrc: {
path: string;
abbreviatedPath: string;
md5: string;
fileName: string;
volume: string;
lesson: string;
interface: {
id: number;
fileName: string;
time: string;
url: string;
uid: string;
contentType: string;
shareCode: null;
shareExpireDate: null;
size: string;
};
};
};
};
}
`` |
If an unimported type is referenced repeatedly, each reference will be qualified with the same
import("path")
expression. Cumulatively, these can significantly enlarge a declaration file.Probably, this will be the first time we need to make non-local edits to a declaration file, which may substantially increase the code complexity. It should not, however, take much more time to execute (unless I'm missing something).
The text was updated successfully, but these errors were encountered: