typescript2.8 Questions
2
Solved
Using the new conditional types in TypeScript (or maybe another technique), is there a way to pick only certain properties from an interface based on their modifiers? For example, having...
interf...
Conjugate asked 30/3, 2018 at 17:55
2
Here is some code with conditional type
class A {
public a: number;
}
class B {
public b: number;
}
type DataType = "a" | "b";
type TData<T extends DataType> =
T extends "a" ? A :
T e...
Olivas asked 12/9, 2018 at 20:6
2
Consider the following code, which uses TypeScript language features introduced in v2.8 (conditional types):
type P<TObject, TPropertySuperType> = {
[K in keyof TObject]: TObject[K] extend...
Hervey asked 21/8, 2018 at 0:49
1
Solved
In the changelog of 2.8, they have this example for conditional types:
type Diff<T, U> = T extends U ? never : T; // Remove types from T that are assignable to U
type T30 = Diff<"a" | "b"...
Campanula asked 29/3, 2018 at 20:16
1
© 2022 - 2024 — McMap. All rights reserved.