I'm experiencing a different behavior of the "keyof" using the constructor assignement...
class Class1 {
constructor(private a: number, private b: string) {
}
method1() {
console.log("method1");
}
}
class Class2 {
a: number;
b: string;
constructor() {
}
method1() {
console.log("method1");
}
}
type Cet1Props = keyof Class1; // "method1"
type Class2Props = keyof Class2; // "a" | "b" | "method1"
I can't understand why is it so, can someone explain me?
Thanks!!