DefinitelyTyped/types/sauronjs/sauronjs-tests.ts
Eric Mulligan 5d5d2ae0c8 Add sauronjs types (#38166)
* Started adding types.

* Missed these changes.

* Adding types.

* Should be good.

* Should be good to go.

* Updated prettier formatting.

* Updated prettier formatting.

* Updated prettier.

* Changed to ReadonlyArray.

* Modified as per review.

* Modified with other recommended changes.
2019-09-27 08:49:06 -07:00

38 lines
771 B
TypeScript

import { cache, Component, events, instance, util, Service } from 'sauronjs';
events.dom.update();
// $ExpectType Component
new Component({ element: new HTMLElement() });
class SomeComponent extends Component {}
// $ExpectType SomeComponent
const example = new SomeComponent({ element: new HTMLElement() });
util.insert(new HTMLElement());
util.ready(() => {
'example';
});
// $ExpectType Service
new Service(['examplePublisher'], ['exampleSubscription']);
class ExampleService extends Service {
constructor() {
super(['examplePublisher'], ['exampleSubscription']);
}
}
// $ExpectType ExampleService
new ExampleService();
// $ExpectType Cache
cache('test');
// $ExpectType void
cache();
// $ExpectType SauronInstance
instance({ example });