Skip to content

Commit fb79b69

Browse files
authored
chore(warning): allow null for location & add configurable kind with Generic (#176)
1 parent 81e8819 commit fb79b69

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

types/warnings.d.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ type WarningName = WarningNameWithValue | "unsafe-import";
2121

2222
type WarningLocation = [[number, number], [number, number]];
2323

24-
interface WarningDefault {
25-
kind: WarningName;
24+
interface WarningDefault<T = WarningName> {
25+
kind: T;
2626
file?: string;
2727
value: string;
28-
source: string;
29-
location: WarningLocation | WarningLocation[];
28+
source: string;
29+
location: null | WarningLocation | WarningLocation[];
3030
i18n: string;
3131
severity: "Information" | "Warning" | "Critical";
3232
experimental?: boolean;
3333
}
3434

35-
type Warning<T extends WarningDefault = WarningDefault> = T extends { kind: WarningNameWithValue } ? T : Omit<T, "value">;
35+
type Warning<T extends WarningDefault = WarningDefault> =
36+
T extends { kind: WarningNameWithValue } ? T : Omit<T, "value">;

0 commit comments

Comments
 (0)