Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Typescript - TypeError: Cannot read property 'createResolver' of undefined #48

Open
rodrigooler opened this issue Dec 14, 2018 · 7 comments

Comments

@rodrigooler
Copy link

rodrigooler commented Dec 14, 2018

The following error is occurring when trying to use apollo-resolvers with typescript, I noticed that several people were having the same problem and I decided to open the issue, more details below.

Error

captura de tela 2018-12-14 as 15 19 00

resolvers

captura de tela 2018-12-14 as 15 22 56

userResolvers

captura de tela 2018-12-14 as 15 20 51

package.json

  "dependencies": {
    "@sentry/node": "4.4.2",
    "apollo-errors": "1.9.0",
    "apollo-resolvers": "1.4.1",
    "apollo-server-micro": "2.3.1",
    "bcryptjs": "2.4.3",
    "bluebird": "3.5.3",
    "ccxt": "1.18.36",
    "date-fns": "1.30.1",
    "dotenv": "6.2.0",
    "graphql": "14.0.2",
    "i18nh": "0.0.4",
    "idx": "2.5.2",
    "jsonwebtoken": "8.4.0",
    "micro": "9.3.3",
    "micro-compose": "0.0.3",
    "micro-cors": "0.1.1",
    "mongoose": "5.3.16",
    "ramda": "0.26.1",
    "ts-node": "7.0.1",
    "validator": "10.9.0"
  },
  "devDependencies": {
    "@types/bcryptjs": "2.4.2",
    "@types/bluebird": "3.5.25",
    "@types/dotenv": "6.1.0",
    "@types/graphql": "14.0.3",
    "@types/jsonwebtoken": "8.3.0",
    "@types/micro": "7.3.3",
    "@types/micro-cors": "0.1.0",
    "@types/mongoose": "5.3.5",
    "@types/ramda": "0.25.43",
    "@types/validator": "9.4.4",
    "husky": "1.2.1",
    "lint-staged": "8.1.0",
    "nodemon": "1.18.8",
    "prettier": "1.15.3",
    "tslint": "5.11.0",
    "tslint-config-prettier": "1.17.0",
    "tslint-config-security": "1.13.0",
    "typescript": "3.2.2"
  },
@fakenickels
Copy link

have you tried adding this to your tsconfig.json compilerOptions?

    "allowSyntheticDefaultImports": true,

@rodrigooler
Copy link
Author

@grsabreu same problem.

tsconfig.json

{
	"compilerOptions": {
		"target": "es5",
		"lib": ["es6"],
		"module": "commonjs",
		// "noImplicitAny": true, // will raise several errors
		"alwaysStrict": true,
		"removeComments": true,
		"preserveConstEnums": true,
		"sourceMap": true,
		"outDir": "dist",
		"allowSyntheticDefaultImports": true,
	},
	"include": [ "**/*" ], 
	"exclude": [
		"dist/*",
		"node_modules",
		"**/*.spec.ts"
	]
}

captura de tela 2018-12-14 as 15 52 31

@rodrigooler
Copy link
Author

Do you have any idea what this problem might be @thebigredgeek? I practically followed the details of the README.md but the only difference is that I am using typescript in the latest version

@thebigredgeek
Copy link
Owner

Huh no clue. it almost looks like something is overriding the value?

@sanket-work
Copy link

is this fixed ?

@thebigredgeek
Copy link
Owner

Let me take a look, apologies i've been busy bootstrapping my company!

@thebigredgeek
Copy link
Owner

#67

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants