diff --git a/lessons/module2/1_TypescriptPart2/homework/easy1.ts b/lessons/module2/1_TypescriptPart2/homework/easy1.ts index 938773d6..5263e960 100644 --- a/lessons/module2/1_TypescriptPart2/homework/easy1.ts +++ b/lessons/module2/1_TypescriptPart2/homework/easy1.ts @@ -3,7 +3,8 @@ // Нужно заменить FIXME на тип который вычисляется на освове OrderState // eslint-disable-next-line @typescript-eslint/no-explicit-any -type FIXME = any; + +type FIXME = Array>; const orderStates = [ "initial", diff --git a/lessons/module2/1_TypescriptPart2/homework/easy2.ts b/lessons/module2/1_TypescriptPart2/homework/easy2.ts index ecf004fe..47f5fa7b 100644 --- a/lessons/module2/1_TypescriptPart2/homework/easy2.ts +++ b/lessons/module2/1_TypescriptPart2/homework/easy2.ts @@ -3,7 +3,7 @@ // Нужно заменить FIXME на тип который достанет из Order все возможные состояния (state) // eslint-disable-next-line @typescript-eslint/no-explicit-any -type FIXME = any; +type FIXME = Order["state"]; type Order = | { diff --git a/lessons/module2/1_TypescriptPart2/homework/easy3.ts b/lessons/module2/1_TypescriptPart2/homework/easy3.ts index 348b8146..1705fd75 100644 --- a/lessons/module2/1_TypescriptPart2/homework/easy3.ts +++ b/lessons/module2/1_TypescriptPart2/homework/easy3.ts @@ -3,13 +3,16 @@ // Нужно заменить FIXME на соответствующий тип // eslint-disable-next-line @typescript-eslint/no-explicit-any -type FIXME = any; +type FIXME, K extends keyof T> = Pick< + T, + Exclude +>; // eslint-disable-next-line @typescript-eslint/no-explicit-any export const omit = , K extends keyof T>( obj: T, keyToOmit: K -): FIXME => { +): FIXME => { // eslint-disable-next-line @typescript-eslint/no-unused-vars const { [keyToOmit]: _, ...withoutKey } = obj; return withoutKey; diff --git a/lessons/module2/1_TypescriptPart2/homework/medium1.ts b/lessons/module2/1_TypescriptPart2/homework/medium1.ts index 15b76fbe..d064f77c 100644 --- a/lessons/module2/1_TypescriptPart2/homework/medium1.ts +++ b/lessons/module2/1_TypescriptPart2/homework/medium1.ts @@ -5,7 +5,7 @@ // Нужно заменить FIXME на правильный тип вычисленный на основе Order // eslint-disable-next-line @typescript-eslint/no-explicit-any -type FIXME = any; +type FIXME = Extract | null; type Order = | { diff --git a/lessons/module2/1_TypescriptPart2/homework/medium2.ts b/lessons/module2/1_TypescriptPart2/homework/medium2.ts index 1ec88f5f..ef919386 100644 --- a/lessons/module2/1_TypescriptPart2/homework/medium2.ts +++ b/lessons/module2/1_TypescriptPart2/homework/medium2.ts @@ -3,11 +3,11 @@ // Нужно заменить FIXME на правильный тип // eslint-disable-next-line @typescript-eslint/no-explicit-any -type FIXME = any; +type FIXME = T extends (...args: any[]) => infer U ? U : T; // Hint: infer export const getDefaultProps = ( component: React.ComponentType -): FIXME => { +): FIXME => { return component.defaultProps; }; diff --git a/lessons/module2/1_TypescriptPart2/homework/medium3.ts b/lessons/module2/1_TypescriptPart2/homework/medium3.ts index 71b9f1e4..ebeabd47 100644 --- a/lessons/module2/1_TypescriptPart2/homework/medium3.ts +++ b/lessons/module2/1_TypescriptPart2/homework/medium3.ts @@ -1,5 +1,7 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any -type FIXME = any; +type FIXME = Array< + Exclude +>; const orderStates = [ "initial",