GithubHelp home page GithubHelp logo

Types about urql HOT 10 CLOSED

urql-graphql avatar urql-graphql commented on May 21, 2024 9
Types

from urql.

Comments (10)

dyst5422 avatar dyst5422 commented on May 21, 2024 1

Basically, if you remove the "allowJs", "experimentalPipelineStage1", and "noEmit" options and specify "outDir": "./build" it will emit to ./build with types and sourcemaps when you run tsc.

from urql.

ar1a avatar ar1a commented on May 21, 2024 1

I can't seem to get type hinting working. I think it's because theyre hidden under a types/ subfolder and not next to the .js or in a @types package.

Would you consider moving them to @types/urql?

from urql.

flexzuu avatar flexzuu commented on May 21, 2024

I explored a route with using dts-gen but it is not that great maybe using tsc instead of babel for the compilation would be better but I am not sure why babel was used in the first place.

from urql.

kenwheeler avatar kenwheeler commented on May 21, 2024

i'm not super familiar with generating or providing types. any tips or pr?

from urql.

dyst5422 avatar dyst5422 commented on May 21, 2024

How do you want it emitted? As commonjs, or es2015 modules?

Also, not sure what benefit you're looking for out of using babel over just tsc as you aren't using the pipeline operator anywhere that you have tagged in the babel plugins.

from urql.

flexzuu avatar flexzuu commented on May 21, 2024

I would second this

Basically, if you remove the "allowJs", "experimentalPipelineStage1", and "noEmit" options and specify "outDir": "./build" it will emit to ./build with types and sourcemaps when you run tsc.

If we come to the conclusion we want to do it with tsc I can do a pr. But I don't get the babel setup.

from urql.

dyst5422 avatar dyst5422 commented on May 21, 2024

There are also a number of other adjustments I would make to the repo, like moving tests outside of the src directory so they don't get sucked into the distributable that's published to NPM. (You can still type check the test files by having a tsconfig that is for the IDE essentially and another one that extends it for building which excludes the tests)

from urql.

ryan-roemer avatar ryan-roemer commented on May 21, 2024

@dyst5422 -- Tests are already ignored for publishing (modulo a small oversight with one file that I've just put up #28 to fix). Take a look at https://unpkg.com/urql/ to see what we actually publish (and lib|es/tests/utils/fetch-mock.js being there is what I've just fixed).

from urql.

ryan-roemer avatar ryan-roemer commented on May 21, 2024

Also, for anyone discussion CJS vs. ESM, our publishing approach is both. See, e.g.:

Hope that helps!

from urql.

kenwheeler avatar kenwheeler commented on May 21, 2024

I'm reluctant to publish the actual .ts source, but as far as definitions, should I be publishing to @types, or running tsc and pointing at that from package.json? cc @danielrossenwasser

from urql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.