TypeScript 6.0 can expose callback assignment errors in projects that relied on the old default of strict: false. It did not introduce strict function checking: strictFunctionTypes has existed since TypeScript 2.6. The error is about safety: a callback that handles only a narrow input cannot be placed in a slot whose callers are allowed to pass a wider range of values.
Why does TypeScript say my callback type is not assignable?
Under strictFunctionTypes, TypeScript checks function parameter types contravariantly. In practical terms, the supplied callback must be able to accept every value the callback slot promises it might receive.
As an Amazon Associate I earn from qualifying purchases.
Suppose Animal is the wider type and Dog is narrower. A function that accepts any Animal can safely be used where a function accepting only Dog is expected: it can handle a dog. The reverse is not safe. A function that accepts only Dog cannot safely fill a slot that may pass any Animal, because a caller could pass a cat.
Free tools Windows power users keep installed
One-click scans. No signup required.
type Animal = { name: string };
type Dog = Animal & { bark(): void };
declare function registerAnimalHandler(handler: (animal: Animal) => void): void;
const handleDog = (dog: Dog) => dog.bark();
registerAnimalHandler(handleDog); // Error: a caller could pass a non-Dog
const handleAnimal = (animal: Animal) => console.log(animal.name);
declare function registerDogHandler(handler: (dog: Dog) => void): void;
registerDogHandler(handleAnimal); // Safe: it can handle any Dog
The assignment direction can feel counterintuitive if you focus on the names of the types. Think instead about the caller: what values is the slot allowed to pass, and can the supplied function handle all of them?
#1 Best Overall
What changes in TypeScript 6.0?
TypeScript 6.0 changes the default for strict to true. A project that omitted strict and depended on the earlier non-strict default may therefore receive new type errors after upgrading. The change is in the default configuration, not the origin of contravariant callback checking. The TypeScript 2.6 release introduced strictFunctionTypes as part of the strict family of checks.
The TSConfig reference describes strictFunctionTypes as true when strict is true and false otherwise. It can also be set directly. Check the TypeScript 6.0 release notes and the strictFunctionTypes option reference for the documented defaults and migration guidance.
Rank #2
- TypeScript implements a superset of syntax for strictly typed development, facilitating deep static analysis and enhanced development environment integration. The compiler translates source into standard script formats, ensuring parity across any runtime.
- TypeScript is ideal for front-end developers, full-stack engineers, and software architects who build large-scale web applications. It serves those looking to improve code excellence, reduce bugs through static checking, and maintain complex projects more.
- Lightweight, Classic fit, Double-needle sleeve and bottom hem
How do I check which setting is causing the error?
-
Confirm the compiler version. Check the TypeScript version used by the build or editor; different invocations can use different installations.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Inspect the configuration and invocation. Look for
strictandstrictFunctionTypesin the applicabletsconfig.json, and check whether the build command selects a different config or passes compiler options on the command line. -
Check the effective setting. The TypeScript configuration reference gives the strict-dependent default:
strictFunctionTypesis enabled whenstrictis enabled, and disabled otherwise. An explicit option can determine the setting directly. -
Read the callback contract. Identify the complete set of inputs the declared callback slot may receive. Compare that set with what the implementation can actually handle.
The official TypeScript 6.0 release notes advise projects that relied on the previous default to set "strict": false explicitly. That preserves the prior broad strict-mode choice; it does not repair an unsafe callback contract.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsWhat is the safe fix for a strictFunctionTypes error?
Broaden the callback parameter when the implementation can handle it
If the callback is genuinely able to process every value permitted by its slot, declare that broader input. For example, use (animal: Animal) => void rather than (dog: Dog) => void when the function does not require dog-specific behavior. This fixes the mismatch at the function boundary and preserves the safety check.
Best Value
Correct the API contract when callers cannot supply the wider type
If the API will only ever invoke the callback with a Dog, its declaration should express that narrower contract. Make this change only when it accurately describes the API’s behavior; otherwise callers may rely on a promise the implementation does not keep.
Keep the old project-wide setting only as a deliberate migration choice
Setting "strict": false can preserve the previous default for a project that is not ready to adopt strict checks. Alternatively, configure strictFunctionTypes explicitly if that is the specific check being managed. Treat either choice as configuration scope, not as proof that an individual callback assignment is safe.
Avoid using a cast as the routine repair
A cast can silence the diagnostic, but it does not make a callback that accepts only dogs safe to call with cats. Use one only when you can independently guarantee the stronger condition the type checker cannot establish; otherwise fix the callback or the API declaration.
Why do methods sometimes behave differently?
TypeScript’s strict contravariant check applies to function types, with an intentional exception for parameters originating in method or constructor declarations. As a result, a method signature and a function-valued property with otherwise similar types can have different assignability behavior.
The exception is a compatibility and type-system design choice. TypeScript 2.6’s release notes explain that it helps generic classes and interfaces such as Array<T> remain mostly covariant. It is not a claim that methods are universally safer at runtime, so changing a function property into a method solely to get past an error can hide an unsafe contract rather than fix it. See the TypeScript 2.6 release notes and the Type Compatibility handbook for the rule and its rationale.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




