Skip to content

Commit

Permalink
chore(hyperscript): use HtmlTagNames and SvgTagNames to type hh() fun… (
Browse files Browse the repository at this point in the history
#109)

* chore(hyperscript): use HtmlTagNames and SvgTagNames to type hh() functions

Use unused imports in hyperscript helper functions

* chore(tests): turn on noUnusedLocals in tsconfig
  • Loading branch information
TylorS committed Dec 9, 2016
1 parent 2ae7b8b commit dde927b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/virtual-dom/helpers/hyperscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface HyperscriptHelperFn<T extends Node> {
(children: VNodeChildren): VirtualNode<T>;
}

export function hh <T extends Node>(tagName: string): HyperscriptHelperFn<T> {
export function hh <T extends Node>(tagName: HtmlTagNames): HyperscriptHelperFn<T> {
return function (): VirtualNode<T> {
const selector = arguments[0];
const data = arguments[1];
Expand Down
2 changes: 1 addition & 1 deletion src/virtual-dom/helpers/svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface SvgHyperscriptHelperFn<T extends SVGElement> {
(children: VNodeChildren): VirtualNode<T>;
}

function hh <T extends SVGElement>(tagName: string): SvgHyperscriptHelperFn<T> {
function hh <T extends SVGElement>(tagName: SvgTagNames): SvgHyperscriptHelperFn<T> {
return function (): VirtualNode<T> {
const selector = arguments[0];
const data = arguments[1];
Expand Down
8 changes: 4 additions & 4 deletions test/driver/integration/events.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as assert from 'assert';
import * as Motorcycle from '@motorcycle/core';
import { div, h4, h3, h2, span, form, input, makeDomDriver } from '../../../src';
import { div, h4, h3, h2, input, makeDomDriver } from '../../../src';
import * as most from 'most';
import { createRenderTarget } from '../../helpers';

Expand Down Expand Up @@ -348,7 +348,7 @@ describe('DOMSource.events()', function () {
el.dispatchEvent(ev);
}

const { sources, dispose } = Motorcycle.run<any, any>(app, {
const { sources } = Motorcycle.run<any, any>(app, {
DOM: makeDomDriver(createRenderTarget()),
});

Expand Down Expand Up @@ -382,7 +382,7 @@ describe('DOMSource.events()', function () {
};
}

const { sources, dispose } = Motorcycle.run<any, any>(app, {
const { sources } = Motorcycle.run<any, any>(app, {
DOM: makeDomDriver(createRenderTarget()),
});

Expand Down Expand Up @@ -416,7 +416,7 @@ describe('DOMSource.events()', function () {
};
}

const { sources, dispose } = Motorcycle.run<any, any>(app, {
const { sources } = Motorcycle.run<any, any>(app, {
DOM: makeDomDriver(createRenderTarget()),
});

Expand Down
10 changes: 5 additions & 5 deletions test/driver/integration/isolation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ describe('isolation', function () {
};
}

const { sinks, dispose } = Motorcycle.run<any, any>(app, {
const { sinks } = Motorcycle.run<any, any>(app, {
DOM: makeDomDriver(createRenderTarget()),
});

Expand Down Expand Up @@ -304,7 +304,7 @@ describe('isolation', function () {
};
}

const { sinks, dispose } = Motorcycle.run<any, any>(IsolatedApp, {
const { sinks } = Motorcycle.run<any, any>(IsolatedApp, {
DOM: makeDomDriver(createRenderTarget()),
});

Expand Down Expand Up @@ -343,7 +343,7 @@ describe('isolation', function () {
};
}

const { sources, dispose } = Motorcycle.run<any, any>(app, {
const { sources } = Motorcycle.run<any, any>(app, {
DOM: makeDomDriver(createRenderTarget()),
});

Expand Down Expand Up @@ -389,7 +389,7 @@ describe('isolation', function () {
};
}

const { sources, dispose } = Motorcycle.run<any, any>(app, {
const { sources } = Motorcycle.run<any, any>(app, {
DOM: makeDomDriver(createRenderTarget()),
});

Expand Down Expand Up @@ -421,7 +421,7 @@ describe('isolation', function () {
};
}

const { sources, dispose } = Motorcycle.run<any, any>(app, {
const { sources } = Motorcycle.run<any, any>(app, {
DOM: makeDomDriver(createRenderTarget()),
});
const isolatedDOMSource = sources.DOM.isolateSource(sources.DOM, 'foo');
Expand Down
2 changes: 1 addition & 1 deletion test/driver/mockDomSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ describe('isolation on MockedDOMSource', function () {
};
}

const {sources, dispose} = run(app, {
const {sources} = run(app, {
DOM: () => mockDomSource({
'.___ISOLATION': {
'.bar': {
Expand Down
1 change: 1 addition & 0 deletions test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"noImplicitAny": false,
"sourceMap": true,
"noUnusedParameters": false,
"noUnusedLocals": true,
"strictNullChecks": true,
"types": [
"hyperscript",
Expand Down

0 comments on commit dde927b

Please sign in to comment.