TSConfig Options and Declaration Files
Up to this point, we have been examining .d.ts
files while keeping a certain option set to false
inside of tsconfig.json
.
In this exercise, however, this mystery option has been set to true
:
// inside tsconfig.json{ "compilerOptions": { "target": "ES2022", "module": "ESN
Transcript
00:00 So far, in all of our trips looking into .d.ts files, we have had a certain TSConfig option set to false. In this exercise, I've set it to true, and we're now seeming like we don't get any errors inside our .d.ts files.
00:17 We're adding an implementation into MyFunc here, but declaration files can't contain implementations, they can only contain types. Why is that happening? Once you've identified the problem which is in the tsconfig.json here, your job is to work out why you would ever want to actually have this option turned on.
00:37 And also, this is actually an option that I recommend in all cases, or at least most cases, that you turn this on by default. So your job is to work out why I would even bother saying that as well. So some complicated stuff here, work out which TSConfig option is causing this problem, turn it off if you like,
00:54 and work out why my recommendation is to always have it on.