Skip to content

TypeScript#15

Merged
dgraham merged 9 commits into
masterfrom
typescript
Oct 18, 2019
Merged

TypeScript#15
dgraham merged 9 commits into
masterfrom
typescript

Conversation

@dgraham

@dgraham dgraham commented Oct 17, 2019

Copy link
Copy Markdown
Contributor

Converts the Flow + Babel toolchain to TypeScript.

The original motivation was to be able to use private instance variables without using the # syntax, but the private modifier is a compile-time only check. We need microsoft/TypeScript#30829 before we can replace our WeakMap state pattern with private fields.

There is no escaping the # syntax.

dgraham and others added 9 commits October 17, 2019 11:55
Co-authored-by: Mu-An Chiou <me@muanchiou.com>
Co-authored-by: Mu-An Chiou <me@muanchiou.com>
Co-authored-by: Mu-An Chiou <me@muanchiou.com>
Co-authored-by: Mu-An Chiou <me@muanchiou.com>
Co-authored-by: Mu-An Chiou <me@muanchiou.com>
Co-authored-by: Mu-An Chiou <me@muanchiou.com>
Co-authored-by: Mu-An Chiou <me@muanchiou.com>
Co-authored-by: Mu-An Chiou <me@muanchiou.com>
Co-authored-by: Mu-An Chiou <me@muanchiou.com>
@dgraham
dgraham requested a review from a team October 17, 2019 20:01
Comment thread src/index.ts
super()
this.currentQuery = null
this.debounceInputChange = debounce(() => fetchResults(this))
this.boundFetchResults = () => fetchResults(this)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

TypeScript's strict-property-initialization test caught these null instance variables previously assigned in the connectedCallback.

Comment thread src/index.ts
let html = ''
try {
response = await fetch(url, {
response = await fetch(url.toString(), {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nice catch by TypeScript where the Fetch API doesn't accept URL values.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Interestingly, fetch does accept URL values, it just implicitly casts them to string: https://twitter.com/Keithamus/status/1185127977249574912

@keithamus keithamus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great 👍

@dgraham
dgraham merged commit 9bf99a4 into master Oct 18, 2019
@dgraham
dgraham deleted the typescript branch October 18, 2019 17:05
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