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
I want to get the return type of an arrow function. Is it possible?
Here is my sample code
export const mySample = () => { const result = { name: 'Foo', today: new Date() } return result; } export type MySampleType = ReturnType<typeof mySample>;
I'm using a simple configuration as following
import { createGenerator } from "ts-json-schema-generator"; const config = { path: "./src/sample.ts", tsconfig: "./tsconfig.json", type: "*", }; const schema = createGenerator(config) .createSchema(config.type); console.log(JSON.stringify(schema, null, 2));
It prints this output
{ "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { "NamedParameters<typeof mySample>": { "type": "object", "additionalProperties": false }, "MySampleType": {} } }
I was expecting to get something like this.
{ "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { "NamedParameters<typeof mySample>": { "type": "object", "additionalProperties": false }, "MySampleType": { "name": "string", "today" "date" } } }
The text was updated successfully, but these errors were encountered:
You code looks reasonable and it would be nice if this worked. Looks like there is a bug somewhere. Can you help fix it?
Sorry, something went wrong.
I upgraded function support significantly in #1910. Please send a pull request to add return values.
No branches or pull requests
I want to get the return type of an arrow function. Is it possible?
Here is my sample code
I'm using a simple configuration as following
It prints this output
I was expecting to get something like this.
The text was updated successfully, but these errors were encountered: