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

TypeScript Cleanup - Bye, bye TODOs #1962

Merged

Conversation

nickytonline
Copy link
Contributor

@bfred-it, just some more post #1735 TODO cleanup. I removed the tiny-version-compare types. The package needs to be bumped in the project, but just waiting for fregante/tiny-version-compare#7 to be merged before going ahead.

@fregante
Copy link
Member

fregante commented Apr 22, 2019

Instead of many tiny PRs let’s reuse this one for any TS-related changes this week

@nickytonline nickytonline changed the title Removed tiny-version-compare types as they will be with the package now. TypeScript Cleanup - Bye, bye TODOs Apr 22, 2019
Copy link
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

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

npm i intervalometer@latest tiny-version-compare@latest shorten-repo-url@latest

@fregante fregante added the meta Related to Refined GitHub itself label Apr 23, 2019

export = compareVersions
}

// TODO: Move types to https://github.com/sindresorhus/linkify-urls repository.
Copy link
Member

@fregante fregante Apr 23, 2019

Choose a reason for hiding this comment

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

This TODO should be updated to point to #1936 (comment)

@nickytonline
Copy link
Contributor Author

This should be good to go. TODOs that remain have had comments updated.

@fregante
Copy link
Member

fregante commented Apr 25, 2019

Any other TODOs across the extension? There are a few more type-related comments I think

@nickytonline
Copy link
Contributor Author

nickytonline commented Apr 25, 2019

Ahh, yeah. True that. I had only globals.d.ts on the brain... 🙃

@fregante
Copy link
Member

I'm surprised to see that the todos are actually already gone. The last one would be this:

// TODO: type target asap and drop `as Element`
const observer = new MutationObserver(([{target}]) => {
	if (!select.exists('.js-details-dialog-spinner', target as Element)) {
		improveShortcutHelp(target as Element);
		fixKeys(target as Element);
		observer.disconnect();
	}
});

Is it possible without adding const dialog: Element = target?

@nickytonline
Copy link
Contributor Author

I was working on the last todo last night. No success yet but basically the MutationCallback interface orMutationRecord interface needs to be altered via a merge declaration. Altering a MutationRecord to make target an Element doesn't seem to work and I was having issues changing the MutationCallback.

I'll take another stab at it tonight and report back.

@fregante
Copy link
Member

Are you trying to change the type of target globally? I don’t think that’s right because target can also be a regular text node.

I think a shortcut would be to add && target instanceof Element to the existing if

@nickytonline nickytonline force-pushed the remove-tiny-version-compare-types branch from 17cc243 to 56353c9 Compare April 25, 2019 16:08
@nickytonline
Copy link
Contributor Author

Alright, a little lunchtime break/commit and I think this is good to go @bfred-it.

@fregante fregante merged commit fba678d into refined-github:master Apr 25, 2019
@fregante
Copy link
Member

Excellent!

@nickytonline nickytonline deleted the remove-tiny-version-compare-types branch April 25, 2019 16:23
@fregante
Copy link
Member

I guess the last step would be to also convert the webpack.config.js (which I was initially against) but it's not necessary. I just pushed abca820 to avoid some TS/eslint conflicts in there

@nickytonline
Copy link
Contributor Author

Happy to convert it if you want. I've done it a bunch of times before.

@fregante
Copy link
Member

✌️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta Related to Refined GitHub itself
Development

Successfully merging this pull request may close these issues.

None yet

2 participants