Skip to content

Commit

Permalink
arg of method's field value adaptive to key
Browse files Browse the repository at this point in the history
  • Loading branch information
Rundll86 committed Nov 10, 2024
1 parent 4324ce2 commit 7457b9a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/fs-context/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export interface ScratchWaterBoxed extends Scratch {
}
export type BlockType = "command" | "reporter";
export type ExtractField<A extends (string | { [key: string]: any })[], F extends string> = {
[K in keyof A as A[K] extends { [key: string]: any } ? (F extends keyof A[K] ? A[K][F] : never) : never]: any;
[K in keyof A as A[K] extends { [key: string]: any } ? (F extends keyof A[K] ? A[K][F] : never) : never]:
A[K] extends { [key: string]: any } ? InputTypeCast["inputType" extends keyof A[K] ? A[K]["inputType"] : "string"] : never;
}
export interface BlockConfig<T extends (string | ArgumentDefine)[]> {
method?: MethodFunction<ExtractField<T, "name">>;
Expand Down Expand Up @@ -62,6 +63,7 @@ export type InputTypeCast = {
color: HexColorString;
"hat-paramater": string;
}
export type _ = InputTypeCast[InputType];
export type TranslatorStoredData = {
[K in LanguageSupported]?: LanguageStored;
} & {
Expand Down

0 comments on commit 7457b9a

Please sign in to comment.