Code Monkey home page Code Monkey logo

Comments (5)

ljharb avatar ljharb commented on May 20, 2024

That’s what DefinitelyTyped is for.

from is-primitive.

geopic avatar geopic commented on May 20, 2024

I'm just proposing another option @ljharb.

from is-primitive.

ljharb avatar ljharb commented on May 20, 2024

Do DT types exist already?

It makes no sense to have a type definition if the project isn’t written in TS, since there’s no reliable way to enforce that the TS type matches the JS file.

from is-primitive.

geopic avatar geopic commented on May 20, 2024

It makes no sense to have a type definition if the project isn’t written in TS, since there’s no reliable way to enforce that the TS type matches the JS file.

Both approaches (having a definition file in the repo vs. having a file at @types/is-primitive) require maintaining. The purpose of a types definition file is to provide types for a library written in JS. Typing a project written in TS which compiles to JS is easier, but most npm packages don't follow that route. In my view it's better to have the definition file as part of the repo as it makes for easier maintainability compared to it being in a different repo, as well as there being less clutter in package.json.

from is-primitive.

ljharb avatar ljharb commented on May 20, 2024

I very much don't agree; if there's no way to enforce keeping them in sync in-repo, the main npm package might release v1.2.3 with a type bug, and be forced to release a v1.2.4 with no actual JS-related changes. Separating them frees the two conceptually different products to be released independently.

from is-primitive.

Related Issues (3)

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.