#Typescript "implements"?
1 messages · Page 1 of 1 (latest)
interfaces are the types, not the implementation, so they aren't really designed to be checked like that
is there any other way to make it somehow work?
don't really think so
if all the values are the same, you can make them align much more easily though
type Keys = "a" | "b";
type A = Record<Keys, boolean>;
type B = Record<Keys, () => void>;
@west bloom
Preview:```ts
interface A {
a: boolean
b: boolean
}
interface B {
a: Function
b: Function
}
interface C {
a: Function
}
// checks
type BContainsAllKeysFromA<
A extends object,
B extends {[K in keyof A]: Function}
= B
type OK1 = BContainsAllKeysFromA<A, B>
...```
You can choose specific lines to embed by selecting them before copying the link.