Skip to content

Commit

Permalink
fix: prevent TS enums from polluting type
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Oct 13, 2021
1 parent 8c5dfca commit 403686d
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions lib/tsconfig.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
import type { CompilerOptions, TypeAcquisition } from 'typescript'

type StripEnums<T extends Record<string, any>> = {
[K in keyof T]: T[K] extends boolean
? T[K]
: T[K] extends string
? T[K]
: T[K] extends object
? T[K]
: T[K] extends Array<any>
? T[K]
: T[K] extends undefined
? undefined
: string
}

export interface TSConfig {
compilerOptions: CompilerOptions;
exclude: string[];
compileOnSave: boolean;
extends: string;
files: string[];
include: string[];
typeAcquisition: TypeAcquisition
compilerOptions?: StripEnums<CompilerOptions>
exclude?: string[]
compileOnSave?: boolean
extends?: string
files?: string[]
include?: string[]
typeAcquisition?: TypeAcquisition
}

0 comments on commit 403686d

Please sign in to comment.