Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit updates our typescript version to latest. It also incorporates related fixes (read: workarounds?) that have blocked the upgrade since 3.6.3. I haven't yet been able to identify the underlying issue, but this seems like a TS regression that's over my head.
The symptom is that within each of our
invoke*
functions,method
is no longer benefiting from thetypeof method === 'function'
check. Within theif
block,method
is being inferred as aT[TMethodName]
rather than aT[TMethodName] & Function
- hencemethod.apply
was now considered invalid (asmethod
is no longer also aFunction
according to TS).The fixes proposed here do limit some of the genericness of the Dispatcher class and its functions, however I'd argue that the level of said genericness is unnecessary.
Dispatcher
really only needs to accept aGraphQLListener
GraphQLListener
only has methods for properties, so the hoops we previously jumped through to collect the names of strictly function properties on an object seem unnecessary and are nicely simplified bykeyof T
.It's worth mentioning a couple things:
Dispatcher
. Autocomplete still smartly suggests the allowed function names of aGraphQLListener
as we would hope.