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

Increase type safety #105

Merged
merged 18 commits into from Mar 10, 2020
Merged

Increase type safety #105

merged 18 commits into from Mar 10, 2020

Conversation

@andyrichardson
Copy link
Contributor

andyrichardson commented Mar 6, 2020

Changes:

  • Remove casting from return types (e.g. (arg): string => arg.maynotbestring)
  • Replace mutation + casting with immutable functions + implicit types
  • Remove unnecessary nulls (arg?: Type | null -> arg?: Type)
  • Handle undefined states higher in the stack (i.e. prevent doSomething(undefined) and remove cascading undefined/null type checks
@andyrichardson andyrichardson force-pushed the increase-implicit-type-safety branch from 54c5a9c to e2ba1ea Mar 6, 2020
variableDefinitions.reduce<Variables>(
(normalized, definition) => ({
...normalized,
[definition.variable.name.value]: valueFromASTUntyped(

This comment has been minimized.

Copy link
@andyrichardson

andyrichardson Mar 6, 2020

Author Contributor

The docs for graphql-js utilities aren't great but after some code snooping, I found we can use this.

@andyrichardson andyrichardson force-pushed the increase-implicit-type-safety branch from 6b3e89c to 8c81483 Mar 9, 2020
@andyrichardson andyrichardson force-pushed the increase-implicit-type-safety branch from 8c81483 to b7cdc6f Mar 9, 2020
owner
} = copyArgs;

return selections.reduce((parsedNodemap, selectionNode): ParsedNodeMap => {

This comment has been minimized.

Copy link
@andyrichardson

andyrichardson Mar 9, 2020

Author Contributor

We can change this to mutation if perf starts to become an issue.

@andyrichardson andyrichardson force-pushed the increase-implicit-type-safety branch from 24216d6 to 7becaf9 Mar 9, 2020
@andyrichardson andyrichardson merged commit 26c7c0e into master Mar 10, 2020
7 checks passed
7 checks passed
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: install Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: lint firefox Your tests passed on CircleCI!
Details
ci/circleci: prettier Your tests passed on CircleCI!
Details
ci/circleci: test Your tests passed on CircleCI!
Details
ci/circleci: visual regression Your tests passed on CircleCI!
Details
@andyrichardson andyrichardson deleted the increase-implicit-type-safety branch Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.