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

type.getFields strikes again #150

Closed
voxmatt opened this issue Mar 8, 2018 · 15 comments · Fixed by #152
Closed

type.getFields strikes again #150

voxmatt opened this issue Mar 8, 2018 · 15 comments · Fixed by #152

Comments

@voxmatt
Copy link

voxmatt commented Mar 8, 2018

I know there have been several issues on this in the past (I've been through this before!) and all had been fixed. But it appears that Graphql 0.13 may break this again

I'm on version 1.4.1 of gql2ts and all was working. But upon upgrading relay-compiler to version 1.5 everything started breaking. On further inspection, relay-compiler 1.4.0requires graphql^0.11.3and version1.5ups that to version^0.13.0`.

If I downgrade relay to 1.4, all works again.

@brettjurgens
Copy link
Contributor

makes sense, i'll loosen the version restriction in gql2ts

@voxmatt
Copy link
Author

voxmatt commented Mar 9, 2018

Thanks for the quick reply!

@brettjurgens
Copy link
Contributor

@voxmatt can you try installing 1.5.0-alpha.90415fad and see if that works?

@voxmatt
Copy link
Author

voxmatt commented Mar 9, 2018

Just tried, still getting:

/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:118
        if (isInputField(field) || !field.args.length) {
                                               ^

TypeError: Cannot read property 'length' of undefined
    at generateArgumentsDeclaration (/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:118:48)

package.json: "gql2ts": "1.5.0-alpha.90415fad",

@brettjurgens
Copy link
Contributor

@voxmatt ahh that's a bug in master that i'm fixing right now. let me cherry-pick that into an earlier version and publish.

@brettjurgens
Copy link
Contributor

@voxmatt ok, can you try 1.5.0-alpha.51c55d43, which is v1.4.3 + #152

@voxmatt
Copy link
Author

voxmatt commented Mar 9, 2018

Sorry @brettjurgens, still errors:

$ GRAPHQL_NO_NAME_WARNING=true gql2ts -n ISchema -i Node -o src/declarations/schema.d.ts build-util/schema.json --legacy
/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:118
        if (isInputField(field) || !field.args.length) {
                                               ^

TypeError: Cannot read property 'length' of undefined
    at generateArgumentsDeclaration (/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:118:48)
    at filteredFields.map.field (/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:170:44)
    at Array.map (<anonymous>)
    at typeToInterface (/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:170:31)
    at typeArr.filter.filter.map.type (/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:198:10)
    at Array.map (<anonymous>)
    at typesToInterfaces (/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:197:14)
    at run (/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:204:12)
    at Object.exports.schemaToInterfaces (/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:206:73)
    at Object.exports.generateNamespace (/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:209:85)

@brettjurgens
Copy link
Contributor

@voxmatt can you make sure that @gql2ts/from-schema is at 1.5.0-alpha.51c55d43? that code shouldn't exist in that release (see: https://unpkg.com/@gql2ts/from-schema@1.5.0-alpha.51c55d43/dist/index.js)

@voxmatt
Copy link
Author

voxmatt commented Mar 9, 2018

yep, verified. node_modules/gql2ts/package.json

{
  "_from": "gql2ts@1.5.0-alpha.51c55d43",
  "_id": "gql2ts@1.5.0-alpha.51c55d43",
  "_inBundle": false,
  "_integrity": "sha512-QVLePajCPyVEEUXy808/VD9SvjeEEnQMt6MxD9CxAtaCHsHnJwG8l8BEwd1ITD2tvQny3DIBNRq7SZFDgqU+Qw==",
  "_location": "/gql2ts",
  "_phantomChildren": {},
  "_requested": {
    "type": "version",
    "registry": true,
    "raw": "gql2ts@1.5.0-alpha.51c55d43",
    "name": "gql2ts",
    "escapedName": "gql2ts",
    "rawSpec": "1.5.0-alpha.51c55d43",
    "saveSpec": null,
    "fetchSpec": "1.5.0-alpha.51c55d43"
  },

Error is:

> GRAPHQL_NO_NAME_WARNING=true gql2ts -n ISchema -i Node -o src/declarations/schema.d.ts build-util/schema.json --legacy

/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:118
        if (isInputField(field) || !field.args.length) {
                                               ^

TypeError: Cannot read property 'length' of undefined
    at generateArgumentsDeclaration (/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:118:48)
    at filteredFields.map.field (/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:170:44)
    at Array.map (<anonymous>)
    at typeToInterface (/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:170:31)
    at typeArr.filter.filter.map.type (/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:198:10)
    at Array.map (<anonymous>)
    at typesToInterfaces (/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:197:14)
    at run (/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:204:12)
    at Object.exports.schemaToInterfaces (/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:206:73)
    at Object.exports.generateNamespace (/Users/mtm/clockwise/src/client-web/webapp/node_modules/@gql2ts/from-schema/dist/index.js:209:85)

@brettjurgens
Copy link
Contributor

brettjurgens commented Mar 9, 2018

@voxmatt that's for gql2ts, can you check @gql2ts/from-schema which is a dependency of gql2ts. alternatively clear node_modules and re-install

@voxmatt
Copy link
Author

voxmatt commented Mar 9, 2018

@brettjurgens sorry, yes, there is a mismatch.

In my package.json I have "gql2ts": "1.5.0-alpha.51c55d43",

But diving into @gql2ts/from-schema shows "version": "1.5.0-alpha.cec79414",

@brettjurgens
Copy link
Contributor

brettjurgens commented Mar 9, 2018

makes sense, can you clear that old version and install the later one?

i think that happens because cec79414 > 51c55d43 even though 51c55d43 is more recent

@voxmatt
Copy link
Author

voxmatt commented Mar 9, 2018

okay, sorry about that, there was a little weirdness with yarn holding onto the old packages, but all seems to work now. Thanks!!

@brettjurgens
Copy link
Contributor

brettjurgens commented Mar 9, 2018

cool, just published 1.4.4 which is identical 51c55d43, closing this out

@voxmatt
Copy link
Author

voxmatt commented Mar 9, 2018

awesome, thanks for the quick work

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 a pull request may close this issue.

2 participants