declare class Foo { constructor(foo: string) foo: string } function Comp(props: { foo: string }) { let foo: Foo type Props = typeof props const update = track((props: Props) => { // Recreate foo whenever `props.foo` changes. Other props are ignored. foo = new Foo(props.foo) }) return (props: Props) => { update(props) // Selectively rerun callbacks on rerender. Minimal boilerplate. return