Skip to content

Commit

Permalink
update generics
Browse files Browse the repository at this point in the history
  • Loading branch information
jribbink committed May 1, 2024
1 parent 93564cf commit b307505
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions packages/types/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -627,11 +627,7 @@ export const Void = typedef(
v => v
)

export const Optional = <
T extends TypeDescriptor<any, JsonCdc<string, unknown>>
>(
children: T
) =>
export const Optional = <T extends TypeDescriptor<any, any>>(children: T) =>
typedef(
"Optional",
(v?: TypeDescriptorInput<T> | null) => ({
Expand All @@ -657,7 +653,7 @@ export const Reference = typedef(
v => v
)

export const _Array = <T extends TypeDescriptor<any, JsonCdc<string, unknown>>>(
export const _Array = <T extends TypeDescriptor<any, any>>(
children: T[] | T = []
) =>
typedef(
Expand All @@ -676,8 +672,8 @@ export const _Array = <T extends TypeDescriptor<any, JsonCdc<string, unknown>>>(
export {_Array as Array}

export const Dictionary = <
K extends TypeDescriptor<any, JsonCdc<string, unknown>>,
V extends TypeDescriptor<any, JsonCdc<string, unknown>>
K extends TypeDescriptor<any, any>,
V extends TypeDescriptor<any, any>
>(
children:
| {
Expand Down Expand Up @@ -727,7 +723,7 @@ export const Dictionary = <
v => v
)

export const Event = <V extends TypeDescriptor<any, JsonCdc<string, unknown>>>(
export const Event = <V extends TypeDescriptor<any, any>>(
id: string,
fields: {value: V}[] | {value: V} = []
) =>
Expand Down Expand Up @@ -755,9 +751,7 @@ export const Event = <V extends TypeDescriptor<any, JsonCdc<string, unknown>>>(
v => v
)

export const Resource = <
V extends TypeDescriptor<any, JsonCdc<string, unknown>>
>(
export const Resource = <V extends TypeDescriptor<any, any>>(
id: string,
fields: {value: V}[] | {value: V} = []
) =>
Expand Down Expand Up @@ -785,7 +779,7 @@ export const Resource = <
v => v
)

export const Struct = <V extends TypeDescriptor<any, JsonCdc<string, unknown>>>(
export const Struct = <V extends TypeDescriptor<any, any>>(
id: string,
fields: {value: V}[] | {value: V} = []
) =>
Expand Down Expand Up @@ -813,7 +807,7 @@ export const Struct = <V extends TypeDescriptor<any, JsonCdc<string, unknown>>>(
v => v
)

export const Enum = <V extends TypeDescriptor<any, JsonCdc<string, unknown>>>(
export const Enum = <V extends TypeDescriptor<any, any>>(
id: string,
fields: {value: V}[] | {value: V} = []
) =>
Expand Down Expand Up @@ -886,7 +880,7 @@ export const Path = typedef(
* InclusiveRange type, step size defaults to 1
*
* @param t - The type of the range, must be a number (UInt32, Int32, etc.)
* @returns A type descriptor for InclusiveRange
* @returns A type descriptor for InclusiveRange<T>
*
* @example
* ```javascript
Expand All @@ -900,11 +894,7 @@ export const Path = typedef(
* const test = fcl.arg([1, 5, 2], InclusiveRange(UInt32))
* ```
*/
export const InclusiveRange = <
T extends TypeDescriptor<any, JsonCdc<string, unknown>>
>(
t: T
) =>
export const InclusiveRange = <T extends TypeDescriptor<any, any>>(t: T) =>
typedef(
"InclusiveRange",
(
Expand Down

0 comments on commit b307505

Please sign in to comment.