Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t.fn should accept unknown in place of arguments #24

Open
arcanis opened this issue Oct 17, 2021 · 0 comments
Open

t.fn should accept unknown in place of arguments #24

arcanis opened this issue Oct 17, 2021 · 0 comments

Comments

@arcanis
Copy link
Owner

arcanis commented Oct 17, 2021

The trick is that while it should accept unknown, it should only accept unknown (or the actual right type). We don't want to allow passing a string as parameter if we know the type should be a number.

import * as t from 'typanion';

declare const foo: unknown;

const fn = t.fn([t.isNumber()], val => {});
fn(42);
fn(foo);

// @ts-expect-error
fn("foo");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant