Skip to content
Myr

Export Mitt types for TS consumers (#101)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Export Mitt types for TS consumers * Add rudimentary tests for exported TS types * Run tests against the generated output instead of src

authored by Jack Franklin · committed by GitHub · parent 59cc3d1 · Browse files · 5 files+63 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+63 added−11 removed

  • tests:+37 added−3 removed
  • other:+26 added−8 removed

5 files+63 added−11 removed

modified:src/index.ts+6 added-6 removed
modified:test/index.js+17 added-3 removed
1import mitt from '../src';1import mitt from '..';2import chai, { expect } from 'chai';3import { spy } from 'sinon';4import sinonChai from 'sinon-chai';5chai.use(sinonChai);67describe('mitt', () => {7it('should default export be a function', () => {8 expect(mitt).to.be.a('function');8 it('should default export be a function', () => {9 expect(mitt).to.be.a('function');10 });1112 it('should accept an optional event handler map', () => {13 expect(() => mitt(new Map())).not.to.throw;14 const map = new Map();15 const a = spy();16 const b = spy();17 map.set('foo', [a, b]);18 const events = mitt(map);19 events.emit('foo');20 expect(a).to.have.been.calledOnce;21 expect(b).to.have.been.calledOnce;22 });23});2425describe('mitt#', () => {26 let events, inst;
156 unmodified lines
added:test/types.ts+20 added
modified:package.json+9 added-2 removed
added:tsconfig.json+11 added