Skip to content

Commit 3ebeba5

Browse files
committed
feat: ignore errors
1 parent 178fe2d commit 3ebeba5

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## Features
88

9-
- 🚀 **Fast**: Blazing-fast `.d.ts` generator, powered by Oxc.
9+
- 🚀 **Fast**: Generates `.d.ts` files significantly faster than `tsc`.
1010
- 🎨 **Transformer**: Support Oxc, SWC, and TypeScript transformer.
1111
- 📦 **Zero Config**: No configuration required, works out of the box.
1212
-**Bundler Support**: Works with Vite, Rollup, and esbuild.
@@ -89,6 +89,7 @@ export interface Options {
8989
transformer?: 'oxc' | 'swc' | 'typescript'
9090
/** Only for typescript transformer */
9191
transformOptions?: TranspileOptions
92+
ignoreErrors?: boolean
9293
}
9394
```
9495

src/core/options.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export type Options = {
55
include?: FilterPattern
66
exclude?: FilterPattern
77
enforce?: 'pre' | 'post' | undefined
8+
ignoreErrors?: boolean
89
} & (
910
| {
1011
/**
@@ -36,5 +37,6 @@ export function resolveOptions(options: Options): OptionsResolved {
3637
exclude: options.exclude || [/node_modules/],
3738
enforce: 'enforce' in options ? options.enforce : 'pre',
3839
transformer: options.transformer || 'oxc',
40+
ignoreErrors: options.ignoreErrors || false,
3941
}
4042
}

src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,12 @@ export const IsolatedDecl: UnpluginInstance<Options | undefined, false> =
7979
}
8080
const { sourceText, errors } = result
8181
if (errors.length) {
82-
this.error(errors[0])
83-
return
82+
if (options.ignoreErrors) {
83+
this.warn(errors[0])
84+
} else {
85+
this.error(errors[0])
86+
return
87+
}
8488
}
8589
addOutput(id, sourceText)
8690
},

0 commit comments

Comments
 (0)