Home/TypeScript Errors/TS2352
Conversion of type 'X' to type 'Y' may be a mistake
TypeScript TS2352 fires when you use 'as' to cast between two types that don't share enough in common — neither type is assignable to the other. TypeScript suspects this is an accidental cast rather than an intentional one.
Why This Happens
You're using a type assertion (as SomeType) between two types that have no structural overlap. TypeScript allows 'as' only when one type is a subtype of the other or they share at least some structure.
Code That Triggers TS2352
// TS2352 examples
const num = 42;
const str = num as string;
// Error: Conversion of type 'number' to type 'string' may be a mistake
// because neither type sufficiently overlaps with the other
interface Cat { meow(): void }
interface Dog { bark(): void }
const cat: Cat = { meow() {} };
const dog = cat as Dog;
// Error: Cat and Dog share no common propertiesHow to Fix TS2352
Option 1: Double assertion via 'unknown' (escape hatch)
// Force any cast by going through 'unknown' first
const str = (num as unknown) as string;
// Use only when you know what you're doing — no type safetyOption 2: Fix the actual type mismatch instead of casting
// Convert the value properly
const str = String(num); // number → string
const strNum = parseInt(str, 10); // string → numberOption 3: Add shared structure to allow the cast
interface Animal { name: string }
interface Cat extends Animal { meow(): void }
interface Dog extends Animal { bark(): void }
// Now Cat and Dog share 'name', so casting is less likely an errorFrequently Asked Questions — TS2352
What does TS2352 mean?
TS2352 means your type cast using 'as' looks suspicious — the two types have no overlap, so TypeScript thinks you might be making a mistake. It's a safeguard against unintentional casts.
How do I force a cast when I'm sure it's correct?
Use double assertion through unknown: (value as unknown) as TargetType. This is an escape hatch — TypeScript won't check it, so only use it when you're certain.
When is it safe to use the double assertion?
When you have external knowledge TypeScript can't verify — for example, a value from an API that you know matches the type, or when integrating with untyped JavaScript code.
TS2352 in test files — how to fix?
Common in mocks. Use jest.fn() with proper generic types, or cast through unknown for mock objects that don't fully implement an interface.
Why doesn't TypeScript allow casting between unrelated types?
TypeScript's type system is structural — if two types share no common shape, a cast between them is almost always a bug. The TS2352 error exists specifically to catch accidental as-casts.
Convert JavaScript to TypeScript automatically
Paste your JS code and get type-annotated TypeScript — including fixes for common type errors — in seconds.
Try the converter →Other TypeScript Errors
From the blog
View all →
May 13, 2026
Convert XML to JSON Online: Complete Guide for Developers (2026)

May 11, 2026
Convert CSV to JSON Online Free (Best Developer Guide 2026)

May 6, 2026
Convert YAML to JSON Online Free (2026 Developer Guide)

Apr 30, 2026
Convert JSON to Zod Schema Online (2026) – Free Tool & Complete Guide

Apr 30, 2026
Top 50 JavaScript to TypeScript Converters (2026) – Free, AI & Online Tools