MCPcopy Create free account
hub / github.com/microsoft/typescript-go / checkModuleExportName

Method checkModuleExportName

internal/checker/checker.go:5371–5382  ·  view source on GitHub ↗
(name *ast.Node, allowStringLiteral bool)

Source from the content-addressed store, hash-verified

5369}
5370
5371func (c *Checker) checkModuleExportName(name *ast.Node, allowStringLiteral bool) {
5372 if name == nil || name.Kind != ast.KindStringLiteral {
5373 return
5374 }
5375 if !allowStringLiteral {
5376 c.grammarErrorOnNode(name, diagnostics.Identifier_expected)
5377 } else if c.moduleKind == core.ModuleKindES2015 || c.moduleKind == core.ModuleKindES2020 {
5378 if !ast.GetSourceFileOfNode(name).IsDeclarationFile {
5379 c.grammarErrorOnNode(name, diagnostics.String_literal_import_and_export_names_are_not_supported_when_the_module_flag_is_set_to_es2015_or_es2020)
5380 }
5381 }
5382}
5383
5384func hasTypeJsonImportAttribute(node *ast.Node) bool {
5385 attributes := node.AsImportDeclaration().Attributes

Callers 3

checkImportBindingMethod · 0.95
checkExportSpecifierMethod · 0.95

Calls 2

grammarErrorOnNodeMethod · 0.95
GetSourceFileOfNodeFunction · 0.92

Tested by

no test coverage detected