fix(typescript): fix unstable optional method (#1770)
parent
59a760c5d8
commit
91bcde9859
|
@ -2354,7 +2354,7 @@ function genericPrintNoParens(path, options, print, args) {
|
||||||
case "TSMethodSignature":
|
case "TSMethodSignature":
|
||||||
parts.push(
|
parts.push(
|
||||||
path.call(print, "name"),
|
path.call(print, "name"),
|
||||||
n.questionToken ? "?" : "",
|
n.questionToken && !n.name.optional ? "?" : "",
|
||||||
printFunctionTypeParameters(path, options, print),
|
printFunctionTypeParameters(path, options, print),
|
||||||
printFunctionParams(path, print, options)
|
printFunctionParams(path, print, options)
|
||||||
);
|
);
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`type_literal_optional_method.ts 1`] = `
|
||||||
|
var v: { e?(): number };
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
var v: { e?(): number };
|
||||||
|
|
||||||
|
`;
|
|
@ -0,0 +1 @@
|
||||||
|
run_spec(__dirname, { parser: "typescript" });
|
|
@ -0,0 +1 @@
|
||||||
|
var v: { e?(): number };
|
Loading…
Reference in New Issue