Skip to content

Commit

Permalink
chore(warning): allow null for location & add configurable kind with …
Browse files Browse the repository at this point in the history
…Generic (#176)
  • Loading branch information
fraxken authored Dec 3, 2023
1 parent 81e8819 commit fb79b69
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions types/warnings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ type WarningName = WarningNameWithValue | "unsafe-import";

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

interface WarningDefault {
kind: WarningName;
interface WarningDefault<T = WarningName> {
kind: T;
file?: string;
value: string;
source: string;
location: WarningLocation | WarningLocation[];
source: string;
location: null | WarningLocation | WarningLocation[];
i18n: string;
severity: "Information" | "Warning" | "Critical";
experimental?: boolean;
}

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

0 comments on commit fb79b69

Please sign in to comment.