Skip to content

/node_modules/@types/graphql/execution/execute.d.ts (55,4): Cannot find name 'Promise'. #140

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

Closed
cibelius opened this issue Jul 24, 2017 · 4 comments

Comments

@cibelius
Copy link

cibelius commented Jul 24, 2017

Hey,

I'm getting this error from running TJS.generateSchema():

/Users/me/my-project/node_modules/@types/graphql/execution/execute.d.ts (55,4): Cannot find name 'Promise'.
/Users/me/my-project/node_modules/@types/graphql/graphql.d.ts (37,4): Cannot find name 'Promise'.
/Users/me/my-project/node_modules/@types/graphql/type/definition.d.ts (244,35): Cannot find name 'Promise'.
/Users/me/my-project/node_modules/@types/graphql/type/definition.d.ts (250,16): Cannot find name 'Promise'.
/Users/me/my-project/node_modules/@types/isomorphic-fetch/index.d.ts (8,30): Cannot find name 'fetch'.
/Users/me/my-project/node_modules/@types/pg/index.d.ts (71,16): Cannot find name 'Promise'.
/Users/me/my-project/node_modules/@types/pg/index.d.ts (74,33): Cannot find name 'Promise'.
/Users/me/my-project/node_modules/@types/pg/index.d.ts (77,53): Cannot find name 'Promise'.
/Users/me/my-project/node_modules/@types/pg/index.d.ts (78,46): Cannot find name 'Promise'.
/Users/me/my-project/node_modules/@types/pg/index.d.ts (96,53): Cannot find name 'Promise'.
/Users/me/my-project/node_modules/@types/pg/index.d.ts (97,46): Cannot find name 'Promise'.
/Users/me/my-project/node_modules/@types/request-promise-native/index.d.ts (11,59): Cannot find name 'Promise'.
/Users/me/my-project/node_modules/@types/request-promise-native/index.d.ts (12,24): Cannot find name 'Promise'.

My code:

import {resolve} from "path";

import * as TJS from "typescript-json-schema";

// optionally pass argument to schema generator
const settings: TJS.PartialArgs = {
    required: true
};


const program = TJS.getProgramFromFiles([resolve("./src/models/Json.ts")]);

// We can either get the schema for one file and one type...
const schema = TJS.generateSchema(program, "Root", settings);

console.log(schema);

My Json.ts-looks like this:

export interface Individual {
  readonly name: string,
  readonly dateOfBirth?: string
}

export interface Root {
  readonly individuals: Individual[]
}

I'm using [email protected].

Any ideas? :)

@domoritz
Copy link
Collaborator

Are you using ES6 output?

@mattyork
Copy link

mattyork commented Aug 7, 2017

I think this will be fixed by updating the version of typescript used in the project. I'm also getting this error for other libraries that use newer types, like the new object type.

@tsuijten
Copy link

tsuijten commented Aug 29, 2017

I also get these errors when I have "@types/jest": "^20.0.8", as a dependency.

When I remove this dependency (which I need for testing) everything works.

@domoritz
Copy link
Collaborator

Part of #99

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

No branches or pull requests

4 participants