In order for js to use the api well, how to make the compiler infer "bar"
type instead of string
without using as const
.
declare function define<T>(
options: {
foo: string;
bar: T;
}
): void;
declare function create<T>( cmd: T ): T;
define( {
foo: "foo",
bar: create( "bar" ) // It still string, instead of "bar"
} );