Giter Site home page Giter Site logo

Comments (2)

blakeembrey avatar blakeembrey commented on May 27, 2024

Is this frowned upon because it pollutes the environment with a namespace that the consumer may not be expecting?

Yes.

Any other thoughts or good ways to do this?

If this is ES6 style with a default export, do how it currently is. Just export alongside the default export. Also, the syntax you're using could be simpler since it's an ES6 import: import Griddle, { CustomColumnComponentProps } from 'griddle-react'. That's what I would normally do, there's no namespacing issues and it's all on the users to do what they want. Does that help?

For ES5/CommonJS modules using module.exports, the type definition is usually a slightly different but similar pattern using a namespace.

declare function main (options: main.Options): void;

declare namespace main {
  export interface Options {}
}

export = main;

from discussions.

hodavidhara avatar hodavidhara commented on May 27, 2024

Ah I had forgotten about the syntax that allows for both default and destructuring, that does make it nicer! I guess I didn't like it because it seems a little misleading to look like you're importing something that doesn't actually exist in the library and is purely defined in the typings, but I guess there is no getting around that.

from discussions.

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.