Reputation: 9958
I'm trying to use ts-xor package that returns a typescript def :
export declare type XOR<T, U> = (T | U) extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
Here is how I'm using it:
/**
* @typedef {import('ts-xor')} XOR
* @typedef {XOR<{
^^^
* small: true
* }, {
* verySmall: true,
* }>} ButtonProps
* @typedef {React.FunctionComponent<ButtonProps>} ButtonComponent
*/
I get :
Type 'XOR' is not generic.ts(2315)
Upvotes: 1
Views: 114
Reputation: 10389
Just declare the import of XOR
with JSDoc @template like the following:
/**
* @template T
* @template U
* @typedef {import('ts-xor').XOR<T,U>} XOR
*/
/**
* @typedef {XOR<{
small: true
}, {
verySmall: true,
}>} ButtonProps
* @typedef {React.FunctionComponent<ButtonProps>} ButtonComponent
*/
Upvotes: 1