How to specify an index signature with know properties of fixed type and all other properties of a different type. The following example behaves as expected with as any but fails when all properties are specified:
type S = {
s?: number;
}
type H = {
[key: string]: Function | undefined;
}
type Handler = S & H
const h1: Handler = {} as any;
/* Ok */
h1.sadwa?.()
h1.s = 2;
/* Not ok */
const h2: Handler = {
s: 22,
f: ()=>{}
}
h2.f()
h2.s = 2;