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

fast check: should infer type when parameter default has a type coercion #21894

Closed
kitsonk opened this issue Jan 11, 2024 · 1 comment · Fixed by #21899
Closed

fast check: should infer type when parameter default has a type coercion #21894

kitsonk opened this issue Jan 11, 2024 · 1 comment · Fixed by #21899
Assignees

Comments

@kitsonk
Copy link
Contributor

kitsonk commented Jan 11, 2024

Version: Deno 1.39.2+70ac061

A type annotation could be inferred and not require an explicit type annotation. I have the following function declared:

export function createMockApp<
  S extends Record<string | number | symbol, any> = Record<string, any>,
>(
  state = {} as S,
): Application<S>;

And fast check should be able to infer the type of state as S instead of requiring an explicit type annotation, but fast check errors with:

Missing explicit type in the public API.
    at file:///Users/kitsonk/github/oak/testing.ts:27:3
@kitsonk
Copy link
Contributor Author

kitsonk commented Jan 11, 2024

I also ran across this with a property initializer, for example:

class A {
  handler = (() => {}) as HandlerMethod;
}

fast check should be able to infer that.

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

Successfully merging a pull request may close this issue.

2 participants