Required vs Unnecessary Annotations
Here we have a function isProblemOrSolution
that includes numerous annotations:
const isProblemOrSolution = (filename: string): boolean => { const splitFilename: string[] = filename.split("."); const finalIndex: number = splitFilename.length - 1; const extension: string | undefined
Transcript
00:00 In this exercise, I want to investigate how many annotations you actually need to make TypeScript understand what you want. So we have here a isProblemOrSolution function which has a bunch of annotations. It has a return type annotation, it has an annotation on split file name, on final index, on extension, on isProblem, on isSolution.
00:18 Everything is annotated here. Your job is to try to work out how many annotations you can remove while still having this test at the bottom make sense and still pass its tests. There's another one down here too in which we have a bunch of code with a bunch of different annotations.
00:33 Your job again is to try to figure out how many of those we can remove while still having the same behavior in the tests. Good luck.