Move sicp.d.ts definitions into the declare module#3
Move sicp.d.ts definitions into the declare module#3sashabjorkman wants to merge 6 commits intoparapluu:hw11-pkd22-23from
Conversation
To get proper type-checking, we must "augment" the `sicp` import as opposed to simply defining an alternate version of it.
|
Improvements have been made to |
|
The definition of |
… have. Might as well add List and Pair to the import to avoid confusion.
|
Thanks @sashabjorkman -- I did not see this PR until now. I am hesitant to change the code so close to the HW deadline but will look at this after today. Much appreciated! |
To get proper type-checking, we should not augment the
sicpimport. Instead we should create a new definition. This is done by moving all "declares" into the declare module. If this isn't done then TypeScript will resolvesicpasany. The result is compiling but type-unsafe code which is not useful for the refactoring stage of homework 11.Please see https://stackoverflow.com/questions/42388217/having-error-module-name-resolves-to-an-untyped-module-at-when-writing-cu as for why this change should be made. Without this change users are shown the following:
This patch makes TypeScript not treat the import as an
anyvalue. The patch has not been tested on TS versions older than 4.7.4. It is possible the patch isn't necessary in older releases.Warmest regards, Alexander Björkman