Git Product home page Git Product logo

Comments (3)

etienne-martin avatar etienne-martin commented on June 5, 2024

type-only files cannot be written as *.d.ts as they will not be emitted by the typescript compiler.

The .d.ts files you use are an input to the build system but not an output. It's perfectly reasonable to consume some types from a .d.ts but have your output not use those types, so there'd be no reason to distribute the input .d.ts with your build results. [...] It sounds like you'll want a post-build step in your build tool to copy the relevant .d.ts files wherever you need them.

The .d.ts files are considered "references" the compiler will not touch them, not move them, or recreate them. An easy way to think of the .d.ts files is that they go along with your .js files. if you are copying the .js files, you should copy the matching .d.ts.

As for having a single type file, these are auto-generated by the tsc compiler based on the structure of the actual source code. This should have no impact on how people consume this library.

What advantages do you see in having a single file for typings?

from device-detector-js.

WuglyakBolgoink avatar WuglyakBolgoink commented on June 5, 2024

@etienne-martin

single file like a https://github.com/apache/cordova-plugin-file/tree/master/types.

if you think, that this is not necessary, then you can close the issue.

from device-detector-js.

etienne-martin avatar etienne-martin commented on June 5, 2024

Ok thanks for the answer.

In the example you gave me, the project is written in javascript and the types are maintained manually and they decided to go with a single .d.ts file.

This is not really possible to do that in this library without introducing additional complexity.

from device-detector-js.

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.