Comments (4)
Module remapping must be done carefully to ensure a single graphql version is pulled, otherwise graphql itself will complain.
This is also a problem generally, but maybe easier to hit in deno? One thing we might want to do in Grats is move toward a model where graphql
is a peer dependency. We are tightly coupled with that package so our support range would be narrow, but it might help avoid the very confusing failure mode where you have two instances.
I think a good next step here would be to add an example deno project here that encodes these issues. Even if it's not a perfectly smooth setup today, it would document the existing workarounds and let us at least capture the situation. As/if we are able to improve that situation, we would be able to update that example as well.
@mandx , If you're interested in working on that, feel free to submit a PR, but no pressure.
from grats.
(Still tinkering on this) Had to use module remapping to force Grats to use the same (newer) Typescript version used in Deno (v5.2.2 at this time) to be able to make it generate a schema from classes/types spread across several TS modules.
The example repo at this time has all resolver classes in a single module and it works fine; but as soon as I did a little refactoring and split the code into some modules, Grats started erroring on "this types are not tagged with @gqlType, etc".
from grats.
Would the TS version be fixed if we switched to making TypeScript a peer dependency (with constrained versions?)
from grats.
The problem specific to Deno is just the version used. I think after v5, TS got smarter about module resolution, which might explain why Grats works with this Deno codebase, but it doesn't with TS v4.9 (the version Grats pulls at the moment).
I'm not sure if the concept of "peer dependency" applies to Deno, but in general, yeah, I think Grats does need to declare typescript
as a peer dependency; this would make sure that all code is checked against a specific version, also, TS is a heavy dependency; I definitely wouldn't want 2+ TS versions in my node_modules
directory.
from grats.
Related Issues (20)
- Format error messages using markdown
- Support defining input types with TypeScript interfaces
- TS Plugin Feature Ideas HOT 2
- Report an error if unknown config options are passed HOT 1
- Fails with (0 , graphql_1.assertName) is not a function if using GraphQL 15.3.0
- When used with earlier versions of TypeScript (^3.8.3) all docblocks are reported as detached
- Create advanced example app
- __typename must be const HOT 5
- Check if we correctly report @gqlField on method/prop of non @gql* construct
- Clarify license is MIT
- Add support for @specifiedBy HOT 1
- Bug: Import paths in the generated typescript schema file contains backslashes when codegen is run on Windows 11 HOT 8
- Union used in a union should not report a __typename missing error
- Have generated schema file export a NodeInterfaceTypenames type
- Add the ability to define fields using static methods just like exported functions
- Allow function fields to be generic
- Always emit stable line endings
- Allow user to specify `importModuleSpecifierEnding` in their config
- Example: likes' count HOT 1
- VSCode plugin not working with TS 5.5.2 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grats.