-
Notifications
You must be signed in to change notification settings - Fork 787
Dependencies update, typescript check tests, fix hoc inference #1402
Dependencies update, typescript check tests, fix hoc inference #1402
Conversation
Error:(45, 3) TS4053: Return type of public method from exported class has or is using name 'React.ReactElement' from external module "react-apollo/node_modules/@types/react/index" but cannot be named.
Error SyntaxError
Dangerfile
Generated by 🚫 dangerJS |
…o lint-fix script
Change lib to 2017 fixes the AsyncIterable problem
My last push is broken, it is failing with errors such as:
I found this somewhat related SO post, except ironically we aren't trying to get the It could be a problem with matcher @jbaxleyiii any thoughts/guidance here? I'd like to get this PR to the finish line. |
The upgraded jest It seems expect(JSON.parse(JSON.stringify(props.data.allPeople))).toEqual(
data1.allPeople,
); I'm making a utility method to serialize/deserialize to wash out the symbols for comparison to the hardcoded fixtures. |
- Reorganized generic typings file into a folder with module per file layout - Moved jest setup files under test/setup (with matcher)
…(breaking change) Fixes issue apollographql#755, Supercedes PR apollographql#1395 - and making progress towards valid typescript in the test directory apollographql#1404
I'm going to publish this privately and start integrating with our codebase to ensure no errors in typing that I didn't already uncover with the tests. |
@rosskevin - I'd recommend updating Danger to 2.x, it stops relying on Jest internals then 👍 |
commit eb0842b Author: Kevin Ross <[email protected]> Date: Thu Dec 14 11:10:55 2017 -0600 rename custom matcher to easier toEqualJson commit ecf05dc Author: Kevin Ross <[email protected]> Date: Thu Dec 14 10:34:28 2017 -0600 update changelog commit 5ebe7d0 Author: Kevin Ross <[email protected]> Date: Thu Dec 14 09:51:35 2017 -0600 change jest config to see if it impacts danger commit 675002f Author: Kevin Ross <[email protected]> Date: Thu Dec 14 09:30:22 2017 -0600 yarn test passes commit 69a7ca6 Author: Kevin Ross <[email protected]> Date: Thu Dec 14 09:16:05 2017 -0600 update typescript usage commit ff65cce Author: Kevin Ross <[email protected]> Date: Thu Dec 14 09:15:41 2017 -0600 examples are not running in master by jest, but evidently the jest upgrade sees this config and needs more work or example module resolution commit c40370a Author: Kevin Ross <[email protected]> Date: Thu Dec 14 08:59:37 2017 -0600 consolidate test-utils commit 5983157 Author: Kevin Ross <[email protected]> Date: Thu Dec 14 08:47:38 2017 -0600 tests are linted commit 926d12e Author: Kevin Ross <[email protected]> Date: Wed Dec 13 19:29:11 2017 -0600 fix compile script commit a032e01 Author: Kevin Ross <[email protected]> Date: Wed Dec 13 19:24:09 2017 -0600 yarn type-check runs commit e2b6355 Author: Kevin Ross <[email protected]> Date: Wed Dec 13 19:24:00 2017 -0600 flow really out of date - some updates to remove redux but not perfect commit 65d5d4b Author: Kevin Ross <[email protected]> Date: Wed Dec 13 19:07:40 2017 -0600 component.test type checks commit 2a53d8f Author: Kevin Ross <[email protected]> Date: Wed Dec 13 18:59:09 2017 -0600 remove more integration tests, server tests type check commit 198005d Author: Kevin Ross <[email protected]> Date: Wed Dec 13 17:54:34 2017 -0600 remove redux integration test commit 9113a1e Author: Kevin Ross <[email protected]> Date: Wed Dec 13 17:47:03 2017 -0600 server/index.test type checks commit 227b439 Author: Kevin Ross <[email protected]> Date: Wed Dec 13 17:46:48 2017 -0600 ApolloProvider.test type checks commit 57d7298 Author: Kevin Ross <[email protected]> Date: Wed Dec 13 17:31:54 2017 -0600 mobx test works, but redux form tests were out of date. typescript updates applied but needs more work commit f13fe1a Author: Kevin Ross <[email protected]> Date: Wed Dec 13 15:58:51 2017 -0600 subscriptions test type checks commit d8d7af5 Author: Kevin Ross <[email protected]> Date: Wed Dec 13 15:52:03 2017 -0600 fix shouldResubscribe props commit 53efa16 Author: Kevin Ross <[email protected]> Date: Wed Dec 13 14:54:05 2017 -0600 fix prettier text jumping and specify the default width just for clarity commit 863718a Author: Kevin Ross <[email protected]> Date: Wed Dec 13 14:45:05 2017 -0600 wip statics commit 5d1b74d Author: Kevin Ross <[email protected]> Date: Wed Dec 13 14:32:54 2017 -0600 add stateless function usage example commit e8f096d Author: Kevin Ross <[email protected]> Date: Wed Dec 13 14:21:08 2017 -0600 type checked shared-operations commit b13bca2 Author: Kevin Ross <[email protected]> Date: Wed Dec 13 14:20:49 2017 -0600 TData and TGraphQLVariables naming consistency. Expose DataValue separately, Expose stronger typed ChildDataProps and ChildMutateProps commit e7039dd Author: Kevin Ross <[email protected]> Date: Wed Dec 13 14:19:36 2017 -0600 disallow synthetic defaults to raise errors sooner commit 24c37ab Author: Kevin Ross <[email protected]> Date: Wed Dec 13 14:19:01 2017 -0600 consistent naming of TData instead of TResult which populates the DataValue commit ae12c3e Author: Kevin Ross <[email protected]> Date: Wed Dec 13 14:18:23 2017 -0600 make purpose of file more clear commit 3f8d7c8 Author: Kevin Ross <[email protected]> Date: Wed Dec 13 09:04:17 2017 -0600 test - client-option and fragments complete commit ada3dd0 Author: Kevin Ross <[email protected]> Date: Tue Dec 12 22:35:42 2017 -0600 test mutations type check commit 36cce91 Author: Kevin Ross <[email protected]> Date: Tue Dec 12 22:06:58 2017 -0600 checkpoint test type checks - queries directory working commit 953a2dd Author: Kevin Ross <[email protected]> Date: Tue Dec 12 18:53:37 2017 -0600 lifecycle.test type checked commit 725bf50 Author: Kevin Ross <[email protected]> Date: Tue Dec 12 18:13:04 2017 -0600 checkpoint commit 3eb018b Author: Kevin Ross <[email protected]> Date: Tue Dec 12 18:11:11 2017 -0600 noUnusedParams cannot be used because the simplest react component is (props) => null commit 2d50050 Author: Kevin Ross <[email protected]> Date: Tue Dec 12 18:03:57 2017 -0600 errors.test and queries.test work commit e4f3c79 Author: Kevin Ross <[email protected]> Date: Tue Dec 12 17:47:13 2017 -0600 api.test back to type checking - seems like other triple slash directives interfered commit e45ab77 Author: Kevin Ross <[email protected]> Date: Tue Dec 12 17:02:21 2017 -0600 unify on one tsconfig and just cleanup after compile - reduces chances of differences in test type checking commit 6c24e71 Author: Kevin Ross <[email protected]> Date: Tue Dec 12 16:51:21 2017 -0600 run prettier on all changes commit 070240b Author: Kevin Ross <[email protected]> Date: Tue Dec 12 16:40:28 2017 -0600 api.test is working/typechecking commit a28fa32 Author: Kevin Ross <[email protected]> Date: Tue Dec 12 16:27:27 2017 -0600 once-over completed on api-test commit d069d70 Author: Kevin Ross <[email protected]> Date: Tue Dec 12 15:38:54 2017 -0600 lint-fix commit 8cbdca6 Author: Kevin Ross <[email protected]> Date: Tue Dec 12 15:37:41 2017 -0600 formating/lint-staged fighting? commit 2fa6968 Author: Kevin Ross <[email protected]> Date: Tue Dec 12 15:36:51 2017 -0600 Expose TChildProps on the outside, allow inference to determine props on the inside commit 94ba1f3 Author: Kevin Ross <[email protected]> Date: Tue Dec 12 15:21:32 2017 -0600 graphql inference looks to working (so far so good) commit 7a54d29 Author: Kevin Ross <[email protected]> Date: Tue Dec 12 14:35:54 2017 -0600 Fix graphql decorator inference and tie together parameterized types (breaking change) Fixes issue apollographql#755, Supercedes PR apollographql#1395 - and making progress towards valid typescript in the test directory apollographql#1404 commit 78b949a Author: Kevin Ross <[email protected]> Date: Tue Dec 12 14:03:52 2017 -0600 fix unnecessary redefinition of React.ComponentType as CompositeComponent commit a37ccfc Author: Kevin Ross <[email protected]> Date: Tue Dec 12 12:54:44 2017 -0600 New jasmine custom matcher added - typescript still unhappy about it. - Reorganized generic typings file into a folder with module per file layout - Moved jest setup files under test/setup (with matcher) commit a7b4d4a Author: Kevin Ross <[email protected]> Date: Tue Dec 12 03:07:21 2017 -0600 revert prettier config to default line length (not matching tslint’s 140 max) commit 47115af Author: Kevin Ross <[email protected]> Date: Mon Dec 11 20:43:27 2017 -0600 revert tsconfig lib back to es2015 from es2017 commit abba30b Author: Kevin Ross <[email protected]> Date: Mon Dec 11 20:30:57 2017 -0600 Remove unused enzyme-to-json commit 8f21aed Author: Kevin Ross <[email protected]> Date: Mon Dec 11 20:13:59 2017 -0600 broken - Symbol(id) is making it into props.data commit a098135 Author: Kevin Ross <[email protected]> Date: Mon Dec 11 19:42:10 2017 -0600 fix duplicate/conflicting export of getDataFromTree namespace commit 9cd83a4 Author: Kevin Ross <[email protected]> Date: Mon Dec 11 19:14:52 2017 -0600 revert danger to 1.2.0 for the moment commit 33d10d0 Author: Kevin Ross <[email protected]> Date: Mon Dec 11 19:11:32 2017 -0600 babel-preset-react-native updated commit 7b415ef Author: Kevin Ross <[email protected]> Date: Mon Dec 11 19:08:43 2017 -0600 cheerio updated commit b02a834 Author: Kevin Ross <[email protected]> Date: Mon Dec 11 19:07:38 2017 -0600 lint-staged, danger updated commit 1867b60 Author: Kevin Ross <[email protected]> Date: Mon Dec 11 19:02:26 2017 -0600 redux-form and redux-loop upgraded commit 7f6affa Author: Kevin Ross <[email protected]> Date: Mon Dec 11 19:01:04 2017 -0600 babel-jest and ts-jest upgrade success commit 72fa15b Author: Kevin Ross <[email protected]> Date: Mon Dec 11 18:57:03 2017 -0600 add changelog to satisfy danger before continuing commit 497f2f8 Author: Kevin Ross <[email protected]> Date: Mon Dec 11 18:49:59 2017 -0600 reuse tsconfig.json for type checking to avoid false positives Change lib to 2017 fixes the AsyncIterable problem commit 8c9f591 Author: Kevin Ross <[email protected]> Date: Mon Dec 11 18:25:42 2017 -0600 make sure sources are linted in the `test` script commit fdedf5d Author: Kevin Ross <[email protected]> Date: Mon Dec 11 18:24:43 2017 -0600 fix lint error commit bad455f Author: Kevin Ross <[email protected]> Date: Mon Dec 11 18:21:04 2017 -0600 fix cli deprecation for tslint commit 824c5b2 Author: Kevin Ross <[email protected]> Date: Mon Dec 11 18:18:44 2017 -0600 run lint-fix (prettier + tslint fix) commit 3e3b125 Author: Kevin Ross <[email protected]> Date: Mon Dec 11 18:14:09 2017 -0600 move prettier to config file for external tool use, add tslint —fix to lint-fix script commit 4ea6b7a Author: Kevin Ross <[email protected]> Date: Mon Dec 11 17:52:25 2017 -0600 Update all non-major versions commit 561a319 Author: Kevin Ross <[email protected]> Date: Mon Dec 11 17:13:06 2017 -0600 typos commit 844356e Author: Kevin Ross <[email protected]> Date: Mon Dec 11 16:50:05 2017 -0600 Fix TS4053 error with latest @types/react Error:(45, 3) TS4053: Return type of public method from exported class has or is using name 'React.ReactElement' from external module "react-apollo/node_modules/@types/react/index" but cannot be named.
@orta I updated to 2.1.4 - so perhaps that is the problem - any guide for 2.x and TS? I saw a bunch of TS related docs removed from the repo. |
Should "just work" will clone and look now. |
Interesting, so the results of running the ts transpiler with your tsconfig.json seems to be that it produces e.g. with the tsconfig, and with an empty config. Digging into see if there's something I'm doing wrong in Danger I think in this case Danger needs to override/remove the module option in a user's tsconfig. Can't see a use-case where it should be needed. |
OK, want to try updating to 2.1.5 please? When I update & run |
Thanks @orta! danger ran without a problem. |
Thanks for poking me - I had a PR on our RN repo which exhibited the same issue artsy/emission#804 |
@jbaxleyiii all green, ready for review. In the meantime I'm working with the package in our codebase to find any inconsistencies with the types. |
Amazing, committed a script change some other test fails. We need a better way than timing, because clearly travis is inconsistent. |
I'm never committing again for fear of breaking the time-dependent tests on travis 😳 |
@rosskevin this is absolutely INCREDIBLE WORK. Thank you SO SO much for showing the imitative and commitment here! I'm good to merge this! |
testing privately (all good so far), but feel free if you want to ping me to confirm before squash+merge
Summary
This PR is largely housekeeping and the fallout from dependency updates. There are no runtime changes included in this PR with the exception of removing the one deprecated
skip
prop.operationOptions.options.skip
, useoperationOptions.skip
insteadTypescript summary
Typescript types have been refactored for consistency and a focus on typescript user experience. This means consistent parameterized type names, types have been refactored and exported individually, and changes made to the signature (exported type names were not changed).
yarn type-check
#1404)types.ts
shouldResubscribe
props onOperationOption
graphql
parameterized types streamlined for a) full typing; and b) ease of use; and c) consistency. New parameterized usage is:graphql<TProps, TData, TGraphQLVariables, TChildProps>
where none are required and full typing only requires the first three params (TChildProps
can be derived). The first three params will be most typical when used in conjunction withapollo-codegen
. Note the ordering of graphql parameters is different to be consistent withChildProps
and variants and to minimize verbosity (supersedes Fully typeChildProps
and reordergraphql()
types to reduce verbosity #1395)ChildDataProps
andChildMutateProps
for optional stronger typed usage version ofChildProps
, and can be used as the fourth parameter tographql
. This is in preparation for a potential split query vs mutation usage of thegraphql
component.Misc
lint-fix
(prettier + tslint --fix)