feat(transformer/typescript): report error relate mts/cts files#3278
feat(transformer/typescript): report error relate mts/cts files#3278
Conversation
Your org has enabled the Graphite merge queue for merging into mainAdd the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Performance ReportMerging #3278 will not alter performanceComparing Summary
|
9233efa to
bf6ad8d
Compare
bf6ad8d to
de0e69d
Compare
|
This feels so weird thrown from the transformer, let me double check. |
|
These are checker errors, we should throw them from the typescript checker. From checker.ts: function checkAssertion(node: AssertionExpression, checkMode: CheckMode | undefined) {
if (node.kind === SyntaxKind.TypeAssertionExpression) {
const file = getSourceFileOfNode(node);
if (file && fileExtensionIsOneOf(file.fileName, [Extension.Cts, Extension.Mts])) {
grammarErrorOnNode(node, Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead);
}
}
return checkAssertionWorker(node, checkMode);
}We don't run semantic check in the test suite, I wonder whether we should 😅 |
Boshen
left a comment
There was a problem hiding this comment.
The check should be done somewhere else.
I initially wanted to throw the error in the semantic, but the transformer doesn't need semantic now. |
|
Let's throw these in semantic checker, and ignore them from the transformer suite because they shouldn't be there ... |
The semantic doesn't have a source_path. Should we pass it in? |
Why do we need source_path? |
These errors only report in files with the .mts or .cts extension |
Oh, the information should be encoded in crates/oxc_span/src/source_type.rs what are their official names and categories? |
Seems they are no official names. |
|

No description provided.