From fced60b8ae1da31214ccb84fea101ed373d62152 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Thu, 24 Nov 2022 14:34:53 +1100 Subject: [PATCH] add a failing test for an interface type Co-authored-by: Jon Koops --- tests/bind.test-d.ts | 14 ++++++++++++++ tests/dedupe.test-d.ts | 14 ++++++++++++++ tests/index.test-d.ts | 16 ++++++++++++++-- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/tests/bind.test-d.ts b/tests/bind.test-d.ts index a04c9d8..80fe119 100644 --- a/tests/bind.test-d.ts +++ b/tests/bind.test-d.ts @@ -1,6 +1,18 @@ import {expectError} from 'tsd'; import bind from '../bind'; +type Foo = { + bar: boolean; +}; + +const foo: Foo = { bar: true }; + +interface IFoo { + bar: boolean; +} + +const ifoo: IFoo = { bar: true }; + // bind bind.default.bind({foo: 'bar'}); const bound = bind.bind({foo: 'bar'}); @@ -22,6 +34,8 @@ bound('bar', null, undefined, true, false, 1234); bound('bar', ['abc', { foo: true }]); bound('bar', ['abc', { foo: true }], { def: false, ijk: 1234 }); bound('abc', 1234, true, false, undefined, null, { foo: true }, ['abc', 1234, true, false, undefined, null, { foo: true }]); +bound(foo); +bound(ifoo); expectError(bound(Symbol())); expectError(bound([Symbol()])); expectError(bound([[Symbol()]])); diff --git a/tests/dedupe.test-d.ts b/tests/dedupe.test-d.ts index 7f4c643..84896e2 100644 --- a/tests/dedupe.test-d.ts +++ b/tests/dedupe.test-d.ts @@ -1,6 +1,18 @@ import {expectError} from 'tsd'; import dedupe from '../dedupe'; +type Foo = { + bar: boolean; +}; + +const foo: Foo = { bar: true }; + +interface IFoo { + bar: boolean; +} + +const ifoo: IFoo = { bar: true }; + // dedupe dedupe.default('foo'); dedupe('foo'); @@ -19,6 +31,8 @@ dedupe('bar', null, undefined, true, false, 1234); dedupe('bar', ['abc', { foo: true }]); dedupe('bar', ['abc', { foo: true }], { def: false, ijk: 1234 }); dedupe('abc', 1234, true, false, undefined, null, { foo: true }, ['abc', 1234, true, false, undefined, null, { foo: true }]); +dedupe(foo); +dedupe(ifoo); expectError(dedupe(Symbol())); expectError(dedupe([Symbol()])); expectError(dedupe([[Symbol()]])); diff --git a/tests/index.test-d.ts b/tests/index.test-d.ts index a7d628a..c2becd5 100644 --- a/tests/index.test-d.ts +++ b/tests/index.test-d.ts @@ -1,6 +1,18 @@ import {expectError} from 'tsd'; import classNames from '..'; +type Foo = { + bar: boolean; +}; + +const foo: Foo = { bar: true }; + +interface IFoo { + bar: boolean; +} + +const ifoo: IFoo = { bar: true }; + // default classNames.default('foo'); classNames('foo'); @@ -20,11 +32,11 @@ classNames('bar', ['abc', { foo: true }]); classNames('bar', ['abc', { foo: true }], { def: false, ijk: 1234 }); classNames('abc', 1234, true, false, undefined, null, { foo: true }, ['abc', 1234, true, false, undefined, null, { foo: true }]); classNames('abc', 1234, true, false, undefined, null, { foo: true }, ['abc', 1234, true, false, undefined, null, { foo: true }], ['abc', 1234, true, false, undefined, null, { foo: true }] as const); - +classNames(foo); +classNames(ifoo); expectError(classNames(Symbol())); expectError(classNames([Symbol()])); expectError(classNames([[Symbol()]])); - // should match tests/index.js classNames('c', ['a', 'b']); classNames('', 'b', {}, '');