Skip to content

Make errors more clear when using an interface with a method.  #39

@jacobgardner

Description

@jacobgardner

Is your feature request related to a problem? Please describe.
When an interface being passed to isType contains a function, we get a stack trace with little indication of what the true error is.

Describe the solution you'd like
Either strip the functions (somehow notifying the user), or give a useful console error.

Error: Unknown type "function"
    at ChainTypeFormatter.getTypeFormatter (/Users/jgardner/ts-audit/node_modules/ts-json-schema-generator/dist/src/ChainTypeFormatter.js:27:15)
    at ChainTypeFormatter.getChildren (/Users/jgardner/ts-audit/node_modules/ts-json-schema-generator/dist/src/ChainTypeFormatter.js:19:21)
    at CircularReferenceTypeFormatter.getChildren (/Users/jgardner/ts-audit/node_modules/ts-json-schema-generator/dist/src/CircularReferenceTypeFormatter.js:28:76)
    at type.getTypes.reduce (/Users/jgardner/ts-audit/node_modules/ts-json-schema-generator/dist/src/TypeFormatter/UnionTypeFormatter.js:38:78)
    at Array.reduce (<anonymous>)
    at UnionTypeFormatter.getChildren (/Users/jgardner/ts-audit/node_modules/ts-json-schema-generator/dist/src/TypeFormatter/UnionTypeFormatter.js:38:14)
    at ChainTypeFormatter.getChildren (/Users/jgardner/ts-audit/node_modules/ts-json-schema-generator/dist/src/ChainTypeFormatter.js:19:44)
    at CircularReferenceTypeFormatter.getChildren (/Users/jgardner/ts-audit/node_modules/ts-json-schema-generator/dist/src/CircularReferenceTypeFormatter.js:28:76)
    at properties.reduce (/Users/jgardner/ts-audit/node_modules/ts-json-schema-generator/dist/src/TypeFormatter/ObjectTypeFormatter.js:39:44)
    at Array.reduce (<anonymous>)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions