Type error with solution to 04-generics-advanced/19-generic-interfaces-with-functions solution
seemaullal opened this issue · 1 comments
seemaullal commented
The solution here https://github.com/total-typescript/typescript-generics-workshop/blob/main/src/04-generics-advanced/19-generic-interfaces-with-functions.solution.ts gives a Typescript error even though it passes all the tests:
clone: <U>(transform: (elem: T | undefined) => U) => Cache<U>;seems to fix the issue
seemaullal commented
Someone pointed out that this is only an issue if noUncheckedIndexedAccess is turned on and it might be off in this repo by default (though I think I am using a slightly different TSConfig and noUncheckedIndexedAccess is on partially due to the suggestion of https://www.totaltypescript.com/tips/make-accessing-objects-safer-by-enabling-nouncheckedindexedaccess-in-tsconfig)
