8000 Validation Context: Which property is not valid on an object · Issue #2 · woutervh-/typescript-is · GitHub
[go: up one dir, main page]

Skip to content
Validation Context: Which property is not valid on an object #2
Closed
@benwinding

Description

@benwinding

Is it possible to determine which property is valid on an object from the AssertType function? Currently I only see Type assertion failed

Something like the following would be helpful:

interface MyRequest {
  name: string,
  age: number
}

try {
  const asString = assertType<MyRequest>(unknownObj);
} catch (e) {
  console.log('error: ', e); // "error: Object does not have property: 'name'   "
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0