TypeScript issue with export

2019-07-23 08:39发布

I'm facing the issue with export in the prisma ts file: I'm running it in the node graphql project.

following is the issue:

05-12-2018 18:20:16: SyntaxError: /home/user/Publish/PracticeBusiness/src/generated/prisma.ts: Unexpected token, expected { (11:7)
05-12-2018 18:20:16:    9 | import { makePrismaBindingClass, BasePrismaOptions } from 'remote-graphql-binding'
05-12-2018 18:20:16:   10 | 
05-12-2018 18:20:16: > 11 | export interface Query {
05-12-2018 18:20:16:      |        ^
05-12-2018 18:20:16:   12 |     agreement: <T = Agreement | null>(args: { id?: Float, name?: String, description?: String, version?: String, type?: Int, validityduration?: Int, inactive?: Boolean, createdat?: String, createdbyid?: Float, updatedat?: String, updatedbyid?: Float, idEq?: Float, nameEq?: String, descriptionEq?: String, versionEq?: String, typeEq?: Int, validitydurationEq?: Int, inactiveEq?: Boolean, createdatEq?: String, createdbyidEq?: Float, updatedatEq?: String, updatedbyidEq?: Float, idGt?: Float, nameGt?: String, descriptionGt?: String, versionGt?: String, typeGt?: Int, validitydurationGt?: Int, inactiveGt?: Boolean, createdatGt?: String, createdbyidGt?: Float, updatedatGt?: String, updatedbyidGt?: Float, idGte?: Float, nameGte?: String, descriptionGte?: String, versionGte?: String, typeGte?: Int, validitydurationGte?: Int, inactiveGte?: Boolean, createdatGte?: String, createdbyidGte?: Float, updatedatGte?: String, updatedbyidGte?: Float, idLt?: Float, nameLt?: String, descriptionLt?: String, versionLt?: String, typeLt?: Int, validitydurationLt?: Int, inactiveLt?: Boolean, createdatLt?: String, createdbyidLt?: Float, updatedatLt?: String, updatedbyidLt?: Float, idLte?: Float, nameLte?: String, descriptionLte?: String, versionLte?: String, typeLte?: Int, validitydurationLte?: Int, inactiveLte?: Boolean, createdatLte?: String, createdbyidLte?: Float, updatedatLte?: String, updatedbyidLte?: Float, idLike?: Float, nameLike?: String, descriptionLike?: String, versionLike?: String, typeLike?: Int, validitydurationLike?: Int, inactiveLike?: Boolean, createdatLike?: String, createdbyidLike?: Float, updatedatLike?: String, updatedbyidLike?: Float, idIsNull?: Boolean, nameIsNull?: Boolean, descriptionIsNull?: Boolean, versionIsNull?: Boolean, typeIsNull?: Boolean, validitydurationIsNull?: Boolean, inactiveIsNull?: Boolean, createdatIsNull?: Boolean, createdbyidIsNull?: Boolean, updatedatIsNull?: Boolean, updatedbyidIsNull?: Boolean, idIn?: Float[], nameIn?: String[], descriptionIn?: String[], versionIn?: String[], typeIn?: Int[], validitydurationIn?: Int[], inactiveIn?: Boolean[], createdatIn?: String[], createdbyidIn?: Float[], updatedatIn?: String[], updatedbyidIn?: Float[], idNotIn?: Float[], nameNotIn?: String[], descriptionNotIn?: String[], versionNotIn?: String[], typeNotIn?: Int[], validitydurationNotIn?: Int[], inactiveNotIn?: Boolean[], createdatNotIn?: String[], createdbyidNotIn?: Float[], updatedatNotIn?: String[], updatedbyidNotIn?: Float[], idLikeNoCase?: Float, nameLikeNoCase?: String, descriptionLikeNoCase?: String, versionLikeNoCase?: String, typeLikeNoCase?: Int, validitydurationLikeNoCase?: Int, inactiveLikeNoCase?: Boolean, createdatLikeNoCase?: String, createdbyidLikeNoCase?: Float, updatedatLikeNoCase?: String, updatedbyidLikeNoCase?: Float, orderBy?: AgreementPropertiesEnum, orderByDesc?: AgreementPropertiesEnum, range?: Int[], limit?: Int[], offset?: Int[] }, info?: GraphQLResolveInfo | string, options?: Options) => Promise<T> ,
05-12-2018 18:20:16:   13 |     agreements: <T = Agreement[] | null>(args: { id?: Float, name?: String, description?: String, version?: String, type?: Int, validityduration?: Int, inactive?: Boolean, createdat?: String, createdbyid?: Float, updatedat?: String, updatedbyid?: Float, idEq?: Float, nameEq?: String, descriptionEq?: String, versionEq?: String, typeEq?: Int, validitydurationEq?: Int, inactiveEq?: Boolean, createdatEq?: String, createdbyidEq?: Float, updatedatEq?: String, updatedbyidEq?: Float, idGt?: Float, nameGt?: String, descriptionGt?: String, versionGt?: String, typeGt?: Int, validitydurationGt?: Int, inactiveGt?: Boolean, createdatGt?: String, createdbyidGt?: Float, updatedatGt?: String, updatedbyidGt?: Float, idGte?: Float, nameGte?: String, descriptionGte?: String, versionGte?: String, typeGte?: Int, validitydurationGte?: Int, inactiveGte?: Boolean, createdatGte?: String, createdbyidGte?: Float, updatedatGte?: String, updatedbyidGte?: Float, idLt?: Float, nameLt?: String, descriptionLt?: String, versionLt?: String, typeLt?: Int, validitydurationLt?: Int, inactiveLt?: Boolean, createdatLt?: String, createdbyidLt?: Float, updatedatLt?: String, updatedbyidLt?: Float, idLte?: Float, nameLte?: String, descriptionLte?: String, versionLte?: String, typeLte?: Int, validitydurationLte?: Int, inactiveLte?: Boolean, createdatLte?: String, createdbyidLte?: Float, updatedatLte?: String, updatedbyidLte?: Float, idLike?: Float, nameLike?: String, descriptionLike?: String, versionLike?: String, typeLike?: Int, validitydurationLike?: Int, inactiveLike?: Boolean, createdatLike?: String, createdbyidLike?: Float, updatedatLike?: String, updatedbyidLike?: Float, idIsNull?: Boolean, nameIsNull?: Boolean, descriptionIsNull?: Boolean, versionIsNull?: Boolean, typeIsNull?: Boolean, validitydurationIsNull?: Boolean, inactiveIsNull?: Boolean, createdatIsNull?: Boolean, createdbyidIsNull?: Boolean, updatedatIsNull?: Boolean, updatedbyidIsNull?: Boolean, idIn?: Float[], nameIn?: String[], descriptionIn?: String[], versionIn?: String[], typeIn?: Int[], validitydurationIn?: Int[], inactiveIn?: Boolean[], createdatIn?: String[], createdbyidIn?: Float[], updatedatIn?: String[], updatedbyidIn?: Float[], idNotIn?: Float[], nameNotIn?: String[], descriptionNotIn?: String[], versionNotIn?: String[], typeNotIn?: Int[], validitydurationNotIn?: Int[], inactiveNotIn?: Boolean[], createdatNotIn?: String[], createdbyidNotIn?: Float[], updatedatNotIn?: String[], updatedbyidNotIn?: Float[], idLikeNoCase?: Float, nameLikeNoCase?: String, descriptionLikeNoCase?: String, versionLikeNoCase?: String, typeLikeNoCase?: Int, validitydurationLikeNoCase?: Int, inactiveLikeNoCase?: Boolean, createdatLikeNoCase?: String, createdbyidLikeNoCase?: Float, updatedatLikeNoCase?: String, updatedbyidLikeNoCase?: Float, orderBy?: AgreementPropertiesEnum, orderByDesc?: AgreementPropertiesEnum, range?: Int[], limit?: Int[], offset?: Int[] }, info?: GraphQLResolveInfo | string, options?: Options) => Promise<T> ,
05-12-2018 18:20:16:   14 |     location: <T = Location | null>(args: { id?: Float, practiceid?: Float, externalid?: Float, name?: String, address?: String, city?: String, state?: String, postalcode?: String, country?: String, email?: String, contactnumber?: String, inactive?: Boolean, createdat?: String, createdbyid?: Float, updatedat?: String, updatedbyid?: Float, idEq?: Float, practiceidEq?: Float, externalidEq?: Float, nameEq?: String, addressEq?: String, cityEq?: String, stateEq?: String, postalcodeEq?: String, countryEq?: String, emailEq?: String, contactnumberEq?: String, inactiveEq?: Boolean, createdatEq?: String, createdbyidEq?: Float, updatedatEq?: String, updatedbyidEq?: Float, idGt?: Float, practiceidGt?: Float, externalidGt?: Float, nameGt?: String, addressGt?: String, cityGt?: String, stateGt?: String, postalcodeGt?: String, countryGt?: String, emailGt?: String, contactnumberGt?: String, inactiveGt?: Boolean, createdatGt?: String, createdbyidGt?: Float, updatedatGt?: String, updatedbyidGt?: Float, idGte?: Float, practiceidGte?: Float, externalidGte?: Float, nameGte?: String, addressGte?: String, cityGte?: String, stateGte?: String, postalcodeGte?: String, countryGte?: String, emailGte?: String, contactnumberGte?: String, inactiveGte?: Boolean, createdatGte?: String, createdbyidGte?: Float, updatedatGte?: String, updatedbyidGte?: Float, idLt?: Float, practiceidLt?: Float, externalidLt?: Float, nameLt?: String, addressLt?: String, cityLt?: String, stateLt?: String, postalcodeLt?: String, countryLt?: String, emailLt?: String, contactnumberLt?: String, inactiveLt?: Boolean, createdatLt?: String, createdbyidLt?: Float, updatedatLt?: String, updatedbyidLt?: Float, idLte?: Float, practiceidLte?: Float, externalidLte?: Float, nameLte?: String, addressLte?: String, cityLte?: String, stateLte?: String, postalcodeLte?: String, countryLte?: String, emailLte?: String, contactnumberLte?: String, inactiveLte?: Boolean, createdatLte?: String, createdbyidLte?: Float, updatedatLte?: String, updatedbyidLte?: Float, idLike?: Float, practiceidLike?: Float, externalidLike?: Float, nameLike?: String, addressLike?: String, cityLike?: String, stateLike?: String, postalcodeLike?: String, countryLike?: String, emailLike?: String, contactnumberLike?: String, inactiveLike?: Boolean, createdatLike?: String, createdbyidLike?: Float, updatedatLike?: String, updatedbyidLike?: Float, idIsNull?: Boolean, practiceidIsNull?: Boolean, externalidIsNull?: Boolean, nameIsNull?: Boolean, addressIsNull?: Boolean, cityIsNull?: Boolean, stateIsNull?: Boolean, postalcodeIsNull?: Boolean, countryIsNull?: Boolean, emailIsNull?: Boolean, contactnumberIsNull?: Boolean, inactiveIsNull?: Boolean, createdatIsNull?: Boolean, createdbyidIsNull?: Boolean, updatedatIsNull?: Boolean, updatedbyidIsNull?: Boolean, idIn?: Float[], practiceidIn?: Float[], externalidIn?: Float[], nameIn?: String[], addressIn?: String[], cityIn?: String[], stateIn?: String[], postalcodeIn?: String[], countryIn?: String[], emailIn?: String[], contactnumberIn?: String[], inactiveIn?: Boolean[], createdatIn?: String[], createdbyidIn?: Float[], updatedatIn?: String[], updatedbyidIn?: Float[], idNotIn?: Float[], practiceidNotIn?: Float[], externalidNotIn?: Float[], nameNotIn?: String[], addressNotIn?: String[], cityNotIn?: String[], stateNotIn?: String[], postalcodeNotIn?: String[], countryNotIn?: String[], emailNotIn?: String[], contactnumberNotIn?: String[], inactiveNotIn?: Boolean[], createdatNotIn?: String[], createdbyidNotIn?: Float[], updatedatNotIn?: String[], updatedbyidNotIn?: Float[], idLikeNoCase?: Float, practiceidLikeNoCase?: Float, externalidLikeNoCase?: Float, nameLikeNoCase?: String, addressLikeNoCase?: String, cityLikeNoCase?: String, stateLikeNoCase?: String, postalcodeLikeNoCase?: String, countryLikeNoCase?: String, emailLikeNoCase?: String, contactnumberLikeNoCase?: String, inactiveLikeNoCase?: Boolean, createdatLikeNoCase?: String, createdbyidLikeNoCase?: Float, updatedatLikeNoCase?: String, updatedbyidLikeNoCase?: Float, orderBy?: LocationPropertiesEnum, orderByDesc?: LocationPropertiesEnum, range?: Int[], limit?: Int[], offset?: Int[] }, info?: GraphQLResolveInfo | string, options?: Options) => Promise<T> ,
05-12-2018 18:20:16:     at Parser.pp$5.raise (/usr/lib/node_modules/babel-cli/node_modules/babylon/lib/index.js:4454:13)
05-12-2018 18:20:16:     at Parser.pp.unexpected (/usr/lib/node_modules/babel-cli/node_modules/babylon/lib/index.js:1761:8)
05-12-2018 18:20:16:     at Parser.pp.expect (/usr/lib/node_modules/babel-cli/node_modules/babylon/lib/index.js:1749:33)
05-12-2018 18:20:16:     at Parser.pp$1.parseExportSpecifiers (/usr/lib/node_modules/babel-cli/node_modules/babylon/lib/index.js:2830:8)
05-12-2018 18:20:16:     at Parser.pp$1.parseExport (/usr/lib/node_modules/babel-cli/node_modules/babylon/lib/index.js:2658:28)
05-12-2018 18:20:16:     at Parser.pp$1.parseStatement (/usr/lib/node_modules/babel-cli/node_modules/babylon/lib/index.js:1884:74)
05-12-2018 18:20:16:     at Parser.pp$1.parseBlockBody (/usr/lib/node_modules/babel-cli/node_modules/babylon/lib/index.js:2268:21)
05-12-2018 18:20:16:     at Parser.pp$1.parseTopLevel (/usr/lib/node_modules/babel-cli/node_modules/babylon/lib/index.js:1778:8)
05-12-2018 18:20:16:     at Parser.parse (/usr/lib/node_modules/babel-cli/node_modules/babylon/lib/index.js:1673:17)
05-12-2018 18:20:16:     at parse (/usr/lib/node_modules/babel-cli/node_modules/babylon/lib/index.js:7305:37)
05-12-2018 18:20:18: SyntaxError: /home/user/Publish/PracticeBusiness/src/generated/prisma.ts: Unexpected token, expected { (11:7)

Thanks in advance.

2条回答
Rolldiameter
2楼-- · 2019-07-23 08:46

I got It fixed, You need to compile the prisma.ts file to prisma.js

For this we need to use 'tsc' in visual studio (find the bellow link for installation) to convert a .ts file to .js and it does the trick.

reference links Can't find Typescript compiler: Command "tsc" is not valid

https://code.visualstudio.com/docs/languages/typescript

查看更多
时光不老,我们不散
3楼-- · 2019-07-23 08:55

It looks like you are trying to use an uncompiled TypeScript file at runtime.

You should probably be loading prisma.js rather than prisma.ts.

查看更多
登录 后发表回答