Skip to content

Commit a253704

Browse files
authored
Print warning in tsgo on currently unsupported file types (microsoft#427)
1 parent 00176f7 commit a253704

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cmd/tsgo/main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,17 @@ func main() {
229229
printDiagnostics(ts.SortAndDeduplicateDiagnostics(diagnostics), host, compilerOptions)
230230
}
231231

232+
var unsupportedExtensions []string
233+
for _, file := range program.SourceFiles() {
234+
extension := tspath.TryGetExtensionFromPath(file.FileName())
235+
if extension == tspath.ExtensionTsx || slices.Contains(tspath.SupportedJSExtensionsFlat, extension) {
236+
unsupportedExtensions = core.AppendIfUnique(unsupportedExtensions, extension)
237+
}
238+
}
239+
if len(unsupportedExtensions) != 0 {
240+
fmt.Fprintf(os.Stderr, "Warning: The project contains unsupported file types (%s), which are currently not fully type-checked.\n", strings.Join(unsupportedExtensions, ", "))
241+
}
242+
232243
if compilerOptions.ListFiles.IsTrue() {
233244
listFiles(program)
234245
}

0 commit comments

Comments
 (0)