Take the below for instance. I'm not quite sure what the error message means, but it seems that logically, the signature is completely valid. Is this just not supported by TS?
function _createNominalCollection<isOutputOrdered_T extends boolean>( input: nominal_T, processingFunc: (count: number) => number, orderedOutput: isOutputOrdered_T = true, ) ^^^ Type 'boolean' is not assignable to type 'isOutputOrdered_T'. 'boolean' is assignable to the constraint of type 'isOutputOrdered_T', but 'isOutputOrdered_T' could be instantiated with a different subtype of constraint 'boolean'.ts(2322) https://stackoverflow.com/questions/66604535/typescript-why-is-it-that-we-cannot-assign-default-value-to-generic-type March 13, 2021 at 01:30AM
没有评论:
发表评论