Closed MTtankkeo closed 5 days ago
This is a TypeScript "issue" (technically working as intended, "limitation" might be a better word), not a Preact issue. See: https://github.com/microsoft/TypeScript/issues/49656. I don't think forming our types in precisely the same way to get around limitations in TS is really within the scope of compat. At that point you might be better off trying to use React's types.
However, you can use something like this instead:
type MyOmit<T, K extends PropertyKey> = { [P in keyof T as Exclude<P, K>]: T[P] }
interface ExampleProperties extends MyOmit<CSSProperties, 'display'> {
[key: string]: any;
}
thanks, and that has helped me a lot.
Oh, and as I forgot to link it, here's a StackOverflow post that I swiped that impl from with a bit more context: https://stackoverflow.com/a/76616671/8963648
This issue is not present in react, In the code above, the auto-completion function of Sample Properties (which seems to be a type inference problem) is not working.
Of course, if you don't use Omit, type inference of the CSSProperties is working.