Skip to content

azu/typescript-json-schema-function-object-issue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

typescript-json-schema-function-bug

Issue

TypeScript Code:

export type Handler = (props: {}) => string
export type HandlerObject = {
    prop: Handler
};

Command

typescript-json-schema index.ts HandlerObject

Expected Result:

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object"
}

Actual Result:

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "properties": {
        "prop": {
            "type": "object"
        }
    },
    "type": "object"
}

Workaround

Use method definition that is ignored YousefED/typescript-json-schema#194.

export type HandlerObject = {
    prop(props: {}): string
};

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT © azu