Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Add TypeScript definitions to package #597

Merged
merged 6 commits into from
May 4, 2021
Merged

Add TypeScript definitions to package #597

merged 6 commits into from
May 4, 2021

Conversation

Nopzen
Copy link
Contributor

@Nopzen Nopzen commented Mar 9, 2021

This PR aims to close #275 by adding a simple index.d.ts to the package repository.

This PR have been some underway first looking at targeting the DefinitelyTyped mono repository, but after small conversation with @johnymontana in the issue we decided to add a simple index.d.ts file here.

Further more this PR have been heavily discussed by users of these definitions here: https://github.com/Nopzen/DefinitelyTyped/pull/1

I created a small test locally to check if the types works as intended by npm linking the neo4j-graphql-js to the test, the screenshots below shows the integration with the VSCode TypeScript language server.

vs-code-code-completion
makeAugmentedSchema-highlight
neo4jgraphql-highlight

I'm very open to feedback and will gladly update any changes the community or maintainers might have.

@nikosantis
Copy link

I think, the package.json need add some script how:

Example using: cpy-cli package

{
   scripts: {
      ...,
      "build": "babel src --presets @babel/preset-env --out-dir dist && npm run build:types",
      "build:types": "cpy 'index.d.ts' dist"
   }
}

What do you think about this?

@Nopzen
Copy link
Contributor Author

Nopzen commented Mar 9, 2021

I think, the package.json need add some script how:

Example using: cpy-cli package

{
   scripts: {
      ...,
      "build": "babel src --presets @babel/preset-env --out-dir dist && npm run build:types",
      "build:types": "cpy 'index.d.ts' dist"
   }
}

What do you think about this?

I was thinking the same but, when I ran npm run build and did the NPM link it seemed to be working so I'm not 100% sure if we need the copying of the index.d.ts, however tho i think if we don't need the copy i need to change:

package.json

{
  "types": "./index.d.ts"
  ...package.json
}

also index.d.ts is not npm ignored. :)

EDIT pushed commit d53132d fixing the package.json types pointer

@nikosantis
Copy link

I think, the package.json need add some script how:
Example using: cpy-cli package

{
   scripts: {
      ...,
      "build": "babel src --presets @babel/preset-env --out-dir dist && npm run build:types",
      "build:types": "cpy 'index.d.ts' dist"
   }
}

What do you think about this?

I was thinking the same but, when I ran npm run build and did the NPM link it seemed to be working so I'm not 100% sure if we need the copying of the index.d.ts, however tho i think if we don't need the copy i need to change:

package.json

{
  types: "./index.d.ts"
  ...package.json
}

also index.d.ts is not npm ignored. :)

Ok!!!!!
im excited about types.
I had to bring a project that was originally going to be in typescript to javascript.
With this, I will be able to do it in ts !!!

Thanks!

@codecov-io
Copy link

codecov-io commented Mar 12, 2021

Codecov Report

Merging #597 (5d97d06) into master (36a754a) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@      Coverage Diff      @@
##   master   #597   +/-   ##
=============================
=============================

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 36a754a...e4a6986. Read the comment docs.

index.d.ts Outdated Show resolved Hide resolved
@michaeldgraham
Copy link
Collaborator

#608

@Nopzen
Copy link
Contributor Author

Nopzen commented May 4, 2021

@johnymontana, could you please tell me what will happen to this PR, loads of people are using my fork because of this atm. but given #608 by @michaeldgraham.

I would like to know if this is a lost cause, I do understand the focus is the new fancy typescript version, but to support people who can't migrate yet should we merge this PR into this repo, or should I abandon this PR and maybe work with @michaeldgraham instead and move my fork to target his repository?

I feel its a shame if people do not get first class IDE support for the tools they use on a daily basis, also given all the feedback I've received from the community so far.

@johnymontana
Copy link
Contributor

Hey @Nopzen - thanks for pinging again and thanks for your patience on this. Yes, I think we can get this in now since it's been in progress for a while and validated with others using your fork and the reviews here.

I'll merge this now and then put this out in a patch release in the next few days.

Thanks so much for working on this!

@johnymontana johnymontana merged commit 84d54a3 into neo4j-graphql:master May 4, 2021
@Nopzen
Copy link
Contributor Author

Nopzen commented May 4, 2021

Thanks @johnymontana should their be raised any issues with these types tag me in such issues i Will get a look at it.

johnymontana pushed a commit that referenced this pull request May 26, 2021
* Add TypeScript definitions to package

* fix: package.json types pointer

* add support for schemaTransformers

* add: definitions for assertSchema

* add: experimental flag to AugmentSchemaConfig interface

* update: signature for neo4jgraphql types

(cherry picked from commit 84d54a3)
@johnymontana
Copy link
Contributor

This is now available in v2.19.4 Thanks again @Nopzen and others for working on this!

@ghost ghost mentioned this pull request Jul 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add typescript types to types repo
6 participants