Skip to content
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

Move to TypeScript #114

Merged
merged 11 commits into from
Mar 28, 2020
Merged

Move to TypeScript #114

merged 11 commits into from
Mar 28, 2020

Conversation

ashmind
Copy link
Owner

@ashmind ashmind commented Mar 16, 2020

This is an initial version of the move -- still needs more testing and has few open questions.

WebAssets/build.js Outdated Show resolved Hide resolved
}
for (const handler of handlersByKey) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(handler as any)(...handlerArguments);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to discuss this one.

@ashmind ashmind requested a review from YaluYou March 17, 2020 08:10
@ashmind ashmind requested a review from jsk95 March 20, 2020 07:07
Copy link
Collaborator

@jsk95 jsk95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah need to split review on this one.. lol

await Promise.all((await fg(['dist/**/*.js'])).map(async path => {
const content = await jetpack.readAsync(path);
const replaced = content.replace(/from '(\.[^']+)';/g, "from '$1.js';");
await jetpack.writeAsync(path, replaced);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of async await here, why not just return writeAsync promise

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems more consistent / easier to follow? Also not much performance difference given it's the build.

@@ -1,8 +1,13 @@
const TestDriver = require('./test-driver.js');
import { TestDriver } from './test-driver';

// TODO: remove in year 3000 when TC39 finally specs this
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coming soon

Copy link
Owner Author

@ashmind ashmind Mar 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like there was no progress since 2018
image


// TODO: remove in year 3000 when TC39 finally specs this
// eslint-disable-next-line no-extend-native
Array.prototype.last = Array.prototype.last || function() { return this[this.length - 1]; };
(Array.prototype as any).last = (Array.prototype as any).last || function<T>(this: Array<T>) { return this[this.length - 1]; };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it here too? Thought I was in a dejavu

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, initial one was one line so it was easier to copy over than reuse in a module.
Tbh probably need to use something like tc39/proposal-array-last#19 (comment) instead for now as there was no progress on last for a while.

@ashmind ashmind marked this pull request as ready for review March 28, 2020 23:27
@ashmind ashmind merged commit 6603ecc into master Mar 28, 2020
@ashmind ashmind deleted the feature/typescript branch March 28, 2020 23:43
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.

2 participants