-
Notifications
You must be signed in to change notification settings - Fork 6
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
Convert execute.js to typescript #403
Comments
On hold until completed: #380 |
@samreid and I feel unblocked to try to convert this now and see what goes wrong. |
We converted execute to typescript and immediately found two problems:
|
I'm going to revert the .js extension additions over in the other issue. |
// Overload when options.errors is 'resolve'
export default function (
cmd: string,
args: string[],
cwd: string,
options: { errors: 'resolve'; [key: string]: any }
): Promise<{
code: number;
stdout: string;
stderr: string;
cwd: string;
error?: Error;
time: number;
}>;
// Overload when options.errors is 'reject' or undefined (default)
export default function (
cmd: string,
args: string[],
cwd: string,
options?: { errors?: 'reject'; [key: string]: any }
): Promise<string>;
// Implementation
export default function (
cmd: string,
args: string[],
cwd: string,
options?: any
): Promise<string | { code: number; stdout: string; stderr: string; cwd: string; error?: Error; time: number }> {
// ...implementation
} |
I decided to push changes from today to a new branch
I listed all commits above. Some of them also cross reference #410. Note the branch has the package.json |
We cherry picked that into the branch, instead of merging all of main into it, and it is working nicely. |
Ok. Merged to main and pushed. All that seems left is:
|
@marlitas reported that
|
Ok. So type checking a js file that require()s a typescript file drops some type information I guess. Above I excluded these from being type checked, but I wonder if actually we should just have updated the tsconfig and linting config for phet-io to support node-based type checking for the scripts dir. |
I committed all changes for better typescript support, and got all TODOs handled. Is there anything more to do here? Please take a look at the above commit to |
Everything looks great here. Nice work on the overloads in execute. I do not see a better alternative for now to the opt-out in phet-io/tsconfig.json. Closing. |
This central file will be a good sanity check for the typescript conversion project. This file is used everywhere, and will let us know quickly and loudly if we forgot about something over in phetsims/chipper#1481
The text was updated successfully, but these errors were encountered: