Bug Report
Current behavior
Convert a TypeScript declare function with a body into a function.
Try it out link
Output:
"use strict";
function foo() {}
Input Code
declare function foo() {}
Expected behavior
It should throw an error like tsc(TypeScript Playground). And it should support errorRecovery.
Also babel/parser should return a node of TSDeclareFunction instead of FunctionDeclaration(declare: true).
Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
- Filename:
babel.config.js
{
"presets": ["@babel/preset-typescript"]
}
Environment
I don't think environment information is needed because this issue is simple, but I will provide it if it is needed for you guys.
Possible Solution
Additional context
While working in Prettier, I notice that declare disappears. (Prettier Playground link)
It is possible to fix this issue on Prettier side, but I think this is the parser's responsibility.
Bug Report
Current behavior
Convert a TypeScript declare function with a body into a function.
Try it out link
Output:
Input Code
Expected behavior
It should throw an error like tsc(TypeScript Playground). And it should support
errorRecovery.Also babel/parser should return a node of
TSDeclareFunctioninstead ofFunctionDeclaration(declare: true).Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
babel.config.jsEnvironment
I don't think environment information is needed because this issue is simple, but I will provide it if it is needed for you guys.
Possible Solution
Additional context
While working in Prettier, I notice that
declaredisappears. (Prettier Playground link)It is possible to fix this issue on Prettier side, but I think this is the parser's responsibility.