Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Commit 94595f1

Browse files
committed
fix: optional transformation warning type
1 parent 43cc008 commit 94595f1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/transform/apply-transformers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type AddSourceMap<T> = Omit<T, 'map'> & { map: RawSourceMap };
4040
export type Transformed = {
4141
code: string;
4242
map: RawSourceMap;
43-
warnings: any[];
43+
warnings?: any[];
4444
};
4545

4646
export function applyTransformersSync<

src/transform/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function transformSync(
6262
cache.set(hash, transformed);
6363
}
6464

65-
if (transformed.warnings.length > 0) {
65+
if (transformed.warnings && transformed.warnings.length > 0) {
6666
const { warnings } = transformed;
6767
for (const warning of warnings) {
6868
console.log(warning);
@@ -108,7 +108,7 @@ export async function transform(
108108
cache.set(hash, transformed);
109109
}
110110

111-
if (transformed.warnings.length > 0) {
111+
if (transformed.warnings && transformed.warnings.length > 0) {
112112
const { warnings } = transformed;
113113
for (const warning of warnings) {
114114
console.log(warning);

0 commit comments

Comments
 (0)