Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type error with solution to 04-generics-advanced/19-generic-interfaces-with-functions solution #16

Open
seemaullal opened this issue Mar 11, 2023 · 1 comment

Comments

@seemaullal
Copy link

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:

image

Changing https://github.com/total-typescript/typescript-generics-workshop/blob/main/src/04-generics-advanced/19-generic-interfaces-with-functions.solution.ts#L8 to

clone: <U>(transform: (elem: T | undefined) => U) => Cache<U>;

seems to fix the issue

@seemaullal
Copy link
Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant