mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-24 20:19:25 -05:00
ensure export modifier is used before default modifier (#44570)
* ensure export modifier is used before default modifier
* gracefully handle `default function`
* Revert "gracefully handle `default function`"
This reverts commit 1d8e288754.
* give better error message on default without leading export
This commit is contained in:
@@ -2429,7 +2429,10 @@ namespace ts {
|
||||
|
||||
function parsingContextErrors(context: ParsingContext) {
|
||||
switch (context) {
|
||||
case ParsingContext.SourceElements: return parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected);
|
||||
case ParsingContext.SourceElements:
|
||||
return token() === SyntaxKind.DefaultKeyword
|
||||
? parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(SyntaxKind.ExportKeyword))
|
||||
: parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected);
|
||||
case ParsingContext.BlockStatements: return parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected);
|
||||
case ParsingContext.SwitchClauses: return parseErrorAtCurrentToken(Diagnostics.case_or_default_expected);
|
||||
case ParsingContext.SwitchClauseStatements: return parseErrorAtCurrentToken(Diagnostics.Statement_expected);
|
||||
|
||||
Reference in New Issue
Block a user