Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Type not inferred correctly after validation by Lisk validator #7953

Closed
Tracked by #7210
Incede opened this issue Jan 5, 2023 · 0 comments · Fixed by #8003
Closed
Tracked by #7210

Type not inferred correctly after validation by Lisk validator #7953

Incede opened this issue Jan 5, 2023 · 0 comments · Fixed by #8003

Comments

@Incede
Copy link
Contributor

Incede commented Jan 5, 2023

Expected behavior

After validator.validate<GetValidatorsByStakeRequest>(getValidatorsByStakeRequestSchema, ctx.params) type of ctx.params should be inferred correctly according to the schema/type provided.

Actual behavior

The type is incorrectly inferred as {} and linter complains.
Invalid type "{}" of template literal expression.
Argument of type '{}' is not assignable to parameter of type 'number'

Casting is needed.
ctx.params.limit as number | undefined

Steps to reproduce

L224 in framework/modules/pos/endpoint.ts

Which version(s) does this affect? (Environment, OS, etc...)

development

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants