Better error messages when Babel fails to parse import = and export =… (#7079)
* Better error messages when Babel fails to parse import = and export = syntax from typescript when using babel-plugin-transform-typescript * Fixing Test cases * Ran make fix and broken looong sentence into smaller * Slight changes to Messages after review with Nicolo & existentialism * Removed trailing space
This commit is contained in:
committed by
Artem Yavorsky
parent
ae3f5b9149
commit
2190e10e9a
@@ -205,11 +205,19 @@ export default function() {
|
||||
},
|
||||
|
||||
TSImportEqualsDeclaration(path) {
|
||||
throw path.buildCodeFrameError("`import =` is not supported.");
|
||||
throw path.buildCodeFrameError(
|
||||
"`import =` is not supported by @babel/plugin-transform-typescript\n" +
|
||||
"Please consider using " +
|
||||
"`import <moduleName> from '<moduleName>';` alongside " +
|
||||
"Typescript's --allowSyntheticDefaultImports option.",
|
||||
);
|
||||
},
|
||||
|
||||
TSExportAssignment(path) {
|
||||
throw path.buildCodeFrameError("`export =` is not supported.");
|
||||
throw path.buildCodeFrameError(
|
||||
"`export =` is not supported by @babel/plugin-transform-typescript\n" +
|
||||
"Please consider using `export <value>;`.",
|
||||
);
|
||||
},
|
||||
|
||||
TSTypeAssertion(path) {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "`export =` is not supported."
|
||||
"throws": "`export =` is not supported by @babel/plugin-transform-typescript\nPlease consider using `export <value>;`."
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "`import =` is not supported."
|
||||
"throws": "`import =` is not supported by @babel/plugin-transform-typescript\nPlease consider using `import <moduleName> from '<moduleName>';` alongside Typescript's --allowSyntheticDefaultImports option."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user