We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
O.PathValid
Hi 👋
When trying to access an object deeper than 3 indirection using O.PathValid, the path becomes invalid.
import { O, A, L } from 'ts-toolbelt' interface IManagement { // keep those fields for the error id: number enterprise_did_id: number label: string code: string service?: IService[] } interface IService { // ...some fields role?: IRole[] } interface IRole { // ...some fields id: number } interface EDID { // ...some fields management?: IManagement[] } function updateEnterpriseDidElement<P extends L.List<string>>( ...path: A.Cast<P, O.PathValid<EDID, P>> ): void { } // error TS2345: Argument of type '"role"' is not assignable to parameter of // type '"service" | "id" | "enterprise_did_id" | "label" | "code"'. updateEnterpriseDidElement("management", "service", "role")
The arguments passed to the updateEnterpriseDidElement should be valid. Am I missing something ?
updateEnterpriseDidElement
The text was updated successfully, but these errors were encountered:
Hey @Dot-H, you made a little mistake. You must allow numbers because IManagement is an array.
IManagement
function updateEnterpriseDidElement<P extends List<string | number>>( ...path: Cast<P, PathValid<EDID, P>> ): void { } updateEnterpriseDidElement('management', 0, 'service', 'role')
Sorry, something went wrong.
Ups, sorry for the false alarm and thanks for the help 🙇♂️
No branches or pull requests
🐞 Bug Report
Describe the bug
Hi 👋
When trying to access an object deeper than 3 indirection using
O.PathValid
, the path becomes invalid.Reproduce the bug
Expected behavior
The arguments passed to the
updateEnterpriseDidElement
should be valid. Am I missing something ?The text was updated successfully, but these errors were encountered: