@@ -48001,39 +48001,28 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
48001
48001
const pos = getNonModifierTokenPosOfNode(node);
48002
48002
const span = getSpanOfTokenAtPosition(sourceFile, pos);
48003
48003
48004
- // Check if we should generate an error (TS 6.0+) or suggestion (older versions)
48005
- const currentVersion = new Version(versionMajorMinor);
48006
- const errorVersion = new Version("6.0");
48007
- const shouldError = currentVersion.compareTo(errorVersion) >= Comparison.EqualTo;
48008
-
48009
- // Check if ignoreDeprecations should suppress this error
48010
- let shouldSuppress = false;
48011
- if (shouldError && compilerOptions.ignoreDeprecations) {
48012
- // Only valid ignoreDeprecations values: "5.0" and "6.0"
48013
- if (compilerOptions.ignoreDeprecations === "6.0") {
48014
- shouldSuppress = true;
48015
- }
48016
- }
48017
-
48018
- if (shouldError && !shouldSuppress) {
48019
- // In TypeScript 6.0+, this is an error unless suppressed by ignoreDeprecations
48020
- const errorDiagnostic = createFileDiagnostic(
48021
- sourceFile,
48022
- span.start,
48023
- span.length,
48024
- Diagnostics.The_module_keyword_is_not_allowed_for_namespace_declarations_Use_the_namespace_keyword_instead,
48025
- );
48026
- diagnostics.add(errorDiagnostic);
48027
- }
48028
- else {
48029
- // In older versions or when suppressed, keep as suggestion
48030
- const suggestionDiagnostic = createFileDiagnostic(
48031
- sourceFile,
48032
- span.start,
48033
- span.length,
48034
- Diagnostics.A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_keyword_instead,
48035
- );
48036
- suggestionDiagnostics.add(suggestionDiagnostic);
48004
+ // Check if ignoreDeprecations should suppress this error
48005
+ const shouldSuppress = compilerOptions.ignoreDeprecations === "6.0";
48006
+
48007
+ if (!shouldSuppress) {
48008
+ // Generate error for module keyword usage in namespace declarations
48009
+ const errorDiagnostic = createFileDiagnostic(
48010
+ sourceFile,
48011
+ span.start,
48012
+ span.length,
48013
+ Diagnostics.The_module_keyword_is_not_allowed_for_namespace_declarations_Use_the_namespace_keyword_instead,
48014
+ );
48015
+ diagnostics.add(errorDiagnostic);
48016
+ }
48017
+ else {
48018
+ // When suppressed by ignoreDeprecations, keep as suggestion
48019
+ const suggestionDiagnostic = createFileDiagnostic(
48020
+ sourceFile,
48021
+ span.start,
48022
+ span.length,
48023
+ Diagnostics.A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_keyword_instead,
48024
+ );
48025
+ suggestionDiagnostics.add(suggestionDiagnostic);
48037
48026
}
48038
48027
}
48039
48028
}
0 commit comments