-
Notifications
You must be signed in to change notification settings - Fork 131
fix: improve support for isolatedModules flag #413
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
base: develop
Are you sure you want to change the base?
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
I have read the CLA Document and I hereby sign the CLA |
KManolov3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
cc: @cwillisf @georgyangelov in case you have an opinion on this
georgyangelov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Export looks good, I left a question for the JSDoc type change
| * Save a project JSON to the project server. | ||
| * This should eventually live in scratch-www. | ||
| * @param {string} projectHost the hostname of the project service. | ||
| * @param {string|undefined} projectHost the hostname of the project service. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it truly possible to have this as undefined? Wouldn't that result in `${projectHost}/${qs}` being undefined/... below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably should never be, I agree but the typing in
scratch-editor/packages/scratch-gui/src/lib/legacy-storage.ts
Lines 6 to 9 in f7e83ec
| import saveProjectToServer from '../lib/save-project-to-server'; | |
| export class LegacyStorage implements GUIStorage { | |
| private projectHost?: string; |
with callsite
| return saveProjectToServer(this.projectHost, projectId, vmState, params); |
is such that it may pass undefined. I agree that it would be good to also fix this there but this small change is effectively just making sure that the typing in the different files is compatible. Depending on the typescript compiler, the build will otherwise file since jsdoc is used to infer type information in js files: https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html
Resolves
As part of our development, we made use of the TypeScript isolatedModules flag and this raised an issue when compiling the project along the lines of:
Proposed Changes
This PR implements the
export typechanges as discussed in this Stackoverflow thread, as well as a minor JSDoc fix.Reason for Changes
These changes are a tiny step in the direction of supporting
isolatedModulesin Scratch and they improve correctness.Test Coverage
I'm not sure what would make sense here, but I'm open to suggestions