Giter VIP home page Giter VIP logo

Comments (17)

the-dr-lazy avatar the-dr-lazy commented on May 14, 2024 5

@Kiarash-Z module bundlers won't load type definition files and consequently type definitions will not appear in the JS bundle files. In fact, the package size will grow but the bundle size will not.
Type definitions only will be load by TypeScript compiler from types property in package.json file.

from react-modern-calendar-datepicker.

arminyahya avatar arminyahya commented on May 14, 2024 1

I added new branch for this feature and after merge, your package need a new version(like 1.1.0) and need to publish on npm

@thebrodmann
@Kiarash-Z

from react-modern-calendar-datepicker.

arminyahya avatar arminyahya commented on May 14, 2024 1

@Kiarash-Z @thebrodmann
There is another way and its i add this index.d.ts file as a package to DefinitelyTyped so developers can install types (like @types/react-modern-calendar-datepicker).
Im glad to do that too.

from react-modern-calendar-datepicker.

the-dr-lazy avatar the-dr-lazy commented on May 14, 2024 1

@Kiarash-Z can you share statistics? It should not affect the JS part of the package!

There is another way and its i add this index.d.ts file as a package to DefinitelyTyped so developers can install types (like @types/react-modern-calendar-datepicker).

I don't recommend this solution. Usually, It's a plan B when maintainers of a module don't wanna accept the maintenance of the type definition.

from react-modern-calendar-datepicker.

Kiarash-Z avatar Kiarash-Z commented on May 14, 2024

Hi @arminyahya,

Does this index.t.ts file need to be published on NPM? or it just gets fetched automatically by the repo connected to the package?

from react-modern-calendar-datepicker.

the-dr-lazy avatar the-dr-lazy commented on May 14, 2024

@Kiarash-Z it should publish. I can work on this.

from react-modern-calendar-datepicker.

Kiarash-Z avatar Kiarash-Z commented on May 14, 2024

@thebrodmann @arminyahya Wouldn't this result in extra bundle size?

from react-modern-calendar-datepicker.

arminyahya avatar arminyahya commented on May 14, 2024

@Kiarash-Z
No, this is only for developer experience and doesn't effect the main bundle

from react-modern-calendar-datepicker.

Kiarash-Z avatar Kiarash-Z commented on May 14, 2024

@arminyahya just tried it, and it adds up to bundle size 😶

from react-modern-calendar-datepicker.

Kiarash-Z avatar Kiarash-Z commented on May 14, 2024

Gotta do some research to find an efficient way to add this 🤔

from react-modern-calendar-datepicker.

Kiarash-Z avatar Kiarash-Z commented on May 14, 2024

@thebrodmann I just considered it simple. When it's gonna get published, it will be there on node_modules/react-modern-calendar-datepicker, and that means it would add up to bundle size, wouldn't it? If it's not going to be there then how developers would detect the types?

from react-modern-calendar-datepicker.

Kiarash-Z avatar Kiarash-Z commented on May 14, 2024

@thebrodmann Got it! thanks for the clear explanation. You can work on a PR for this if you wish. By the way, is adding types by an index.d.ts file the best way for adding types?

from react-modern-calendar-datepicker.

arminyahya avatar arminyahya commented on May 14, 2024

@Kiarash-Z @thebrodmann
I did a PR for this before.
Didn't you Receive that?

from react-modern-calendar-datepicker.

Kiarash-Z avatar Kiarash-Z commented on May 14, 2024

@arminyahya Nope. Nothing in Pull Requests section:/

from react-modern-calendar-datepicker.

arminyahya avatar arminyahya commented on May 14, 2024

@Kiarash-Z @thebrodmann
Hmm
I finished this last week,maybe i forget something.
Let me back home and create a PR.

from react-modern-calendar-datepicker.

the-dr-lazy avatar the-dr-lazy commented on May 14, 2024

By the way, is adding types by an index.d.ts file the best way for adding types?

Yeah, I think so. It's our plan A. :D

from react-modern-calendar-datepicker.

Kiarash-Z avatar Kiarash-Z commented on May 14, 2024

Resolved in #64

from react-modern-calendar-datepicker.

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.