From 474a34b86cf0d78163dbbe68c28049c467d8ccda Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 25 Apr 2024 12:24:24 -0700 Subject: [PATCH] Exclude methods from strict checking --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0f2e1e6d195..a0dd0b2bc01 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -23090,7 +23090,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // This is only applied during the strictSubtypeRelation -- currently used in subtype reduction if ( (relation === strictSubtypeRelation || enforceReadonly) && - isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp) + isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp) && !(targetProp.flags & SymbolFlags.Method) ) { if (reportErrors) { reportError(Diagnostics.Property_0_is_readonly_in_the_source_but_not_in_the_target, symbolToString(targetProp));