Move sicp.d.ts definitions into the declare module #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To get proper type-checking, we should not augment the
sicp
import. 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 resolvesicp
asany
. 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
any
value. 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