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

Function GetDeclarationFileExtension

internal/tspath/extension.go:111–125  ·  view source on GitHub ↗
(fileName string)

Source from the content-addressed store, hash-verified

109}
110
111func GetDeclarationFileExtension(fileName string) string {
112 base := GetBaseFileName(fileName)
113 for _, ext := range SupportedDeclarationExtensions {
114 if strings.HasSuffix(base, ext) {
115 return ext
116 }
117 }
118 if strings.HasSuffix(base, ExtensionTs) {
119 index := strings.Index(base, ".d.")
120 if index >= 0 {
121 return base[index:]
122 }
123 }
124 return ""
125}
126
127func GetDeclarationEmitExtensionForPath(path string) string {
128 switch {

Callers 8

GetEditsForFileRenameMethod · 0.92
processEndingFunction · 0.92
ProcessEntrypointEndingFunction · 0.92
IsDeclarationFileNameFunction · 0.85
ChangeFullExtensionFunction · 0.85

Calls 1

GetBaseFileNameFunction · 0.85

Tested by

no test coverage detected