From 72b570917e1e6c9ca1073e26a8519bf43e05468b Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 6 Feb 2023 09:02:41 +0800 Subject: [PATCH] chore: catch unhandled export as just in case --- rollup.dts.config.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rollup.dts.config.js b/rollup.dts.config.js index 63906c10d1..84a6138b44 100644 --- a/rollup.dts.config.js +++ b/rollup.dts.config.js @@ -143,6 +143,17 @@ function patchTypes(pkg) { spec.type === 'ExportSpecifier' && shouldRemoveExport.has(spec.local.name) ) { + // @ts-ignore + const exported = spec.exported.name + if (exported !== spec.local.name) { + // this only happens if we have something like + // type Foo + // export { Foo as Bar } + // there are no such cases atm, so it is unhandled for now. + throw new Error( + `removed export ${exported} has different local name: ${spec.local.name}` + ) + } const next = node.specifiers[i + 1] if (next) { // @ts-ignore -- 2.47.3