Skip to content

TypeScript Cleanup - Bye, bye TODOs - #1962

Merged
fregante merged 11 commits into
refined-github:masterfrom
nickytonline:remove-tiny-version-compare-types
Apr 25, 2019
Merged

fregante merged 11 commits into
refined-github:masterfrom
nickytonline:remove-tiny-version-compare-types

Conversation

@nickytonline

Copy link
Copy Markdown
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

fregante commented Apr 22, 2019 •

Copy link
Copy Markdown
Member

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

@fregante fregante left a comment

Copy link
Copy Markdown
Member

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
Comment thread source/globals.d.ts Outdated
export = compareVersions
}

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

@fregante fregante Apr 23, 2019 •

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor Author

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

@fregante

fregante commented Apr 25, 2019 •

Copy link
Copy Markdown
Member

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

@nickytonline

nickytonline commented Apr 25, 2019 •

Copy link
Copy Markdown
Contributor Author

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

@fregante

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Excellent!

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

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

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

@fregante

Copy link
Copy Markdown
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.

2 participants