File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 1- import { PackageJson , PartialDeep , TsConfigJson } from "type-fest" ;
1+ import { PackageJson , PartialDeep , TsConfigJson , JsonValue } from "type-fest" ;
22import detectIndent from "detect-indent" ;
33import stripBom from "strip-bom" ;
44import parseJson from "parse-json" ;
@@ -39,14 +39,16 @@ type ModifyFields<T extends object> = {
3939} ;
4040
4141type ModifyFunction < T > = ( oldJson : T ) => MaybePromise < T > ;
42+ // todo why can't use JsonValue from type-fest
43+ type JsonRoot = number | string | boolean | null | object | any [ ] ;
4244
43- export type ModifyJsonFileFunction < T > = (
45+ export type ModifyJsonFileFunction < T extends JsonRoot > = (
4446 path : string ,
4547 modifyFields : T extends object ? ModifyFields < T > | ModifyFunction < T > : ModifyFunction < T > ,
4648 options ?: Partial < Options >
4749) => Promise < void > ;
4850
49- type ModifyJsonFileGenericFunction = < T extends any = object > (
51+ type ModifyJsonFileGenericFunction = < T extends JsonRoot = object > (
5052 path : string ,
5153 modifyFields : T extends object ? ModifyFields < T > | ModifyFunction < T > : ModifyFunction < T > ,
5254 options ?: Partial < Options >
You can’t perform that action at this time.
0 commit comments