hotwired / stimulus

A modest JavaScript framework for the HTML you already have
https://stimulus.hotwired.dev/
MIT License
12.62k stars 418 forks source link

"export as namespace" in index.d.ts #238

Closed benjamin-hodgson closed 5 years ago

benjamin-hodgson commented 5 years ago

I want to use Stimulus as a UMD global from a non-module-based TypeScript project.

// foo_controller.ts
class FooController extends Stimulus.Controller {
    // ...
}

The index.d.ts file which ships with Stimulus only declares a TypeScript module, not a UMD global as well, which means that you can't use Stimulus in a TS script file.

Please could you add export as namespace Stimulus to index.d.ts?

sstephenson commented 5 years ago

We’d have to do this in a post-build step, I think. Our .d.ts files are generated by the TypeScript compiler, not checked into the source tree.

benjamin-hodgson commented 5 years ago

Is this not it? https://github.com/stimulusjs/stimulus/blob/master/packages/stimulus/index.d.ts

sstephenson commented 5 years ago

I’m sorry. I was thinking of the @stimulus/core package. You’re correct, that’s where the change should be made.

benjamin-hodgson commented 5 years ago

No worries. Would you like me to send you a pull request or would you prefer to do it yourself?

sstephenson commented 5 years ago

A pull request would be great - thank you!