Compile-time prop types

Declare the shape as a named type and pass it as the class type argument — extends WebComponent<TypedButtonProps> — and this.props.* is checked against it instead of being any.

The buttons above are ordinary reactive props; the point of this example is what the compiler now sees. In index.ts below, this.props.variant is string, this.props.disabled is boolean, and each line in CompileErrors is a real type error kept honest by @ts-expect-error.


Without the type argument

Omitting it keeps the previous behavior: every read is any, so a typo like this.props.varient compiles fine.

Runtime is unchanged either way. Types are erased before the browser sees this file — static strictProps is still what guards values arriving from attributes at runtime.