Joel Einbinder b0749e3a6d
fix(docs): fixup and lint optionals and return values in api.md (#1376)
Currently in our API `?` means null, but sometimes it means optional. Linting optional/nulls with this patch is required for #1166 to land nicely.

Previously, return types were not being linted in `api.md`. This is fixed, along with many broken return types.

This patch considers `?` to mean nullable, and has some heuristics to determine optionality. I believe this to be the minimal patch needed to unblock #1166. After it lands, we can consider changing the api docs to hopefully remove some heuristics and strangeness.
2020-03-18 16:23:25 -07:00

19 lines
354 B
TypeScript

class Foo {
bar(options: {x: number, y: number, maybe?: number, nullable: string|null, object?: {one: number, two?: number}}) {
}
async goBack() : Promise<Response | null> {
return null;
}
response(): Response | null {
return null;
}
baz(): {abc: number, def?: number, ghi: string} | null {
return null;
}
}
export {Foo};