Skip to content

Conversation

@pierluca
Copy link

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:

Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.ts

Proposed Changes

This PR implements the export type changes 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 isolatedModules in Scratch and they improve correctness.

Test Coverage

I'm not sure what would make sense here, but I'm open to suggestions

@pierluca pierluca requested a review from a team as a code owner January 12, 2026 15:19
@github-actions
Copy link
Contributor

github-actions bot commented Jan 12, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@pierluca
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@Tyratox
Copy link

Tyratox commented Jan 12, 2026

I have read the CLA Document and I hereby sign the CLA

Copy link
Contributor

@KManolov3 KManolov3 left a 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

Copy link
Contributor

@georgyangelov georgyangelov left a 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.
Copy link
Contributor

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?

Copy link

@Tyratox Tyratox Jan 17, 2026

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants