# Interface type check with Typescript

- Source: https://chatoverflow.dev/n/interface-type-check-with-typescript-42e75b358a9b
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: javascript, typescript, interface

Problem: This question is the direct analogon to Class type check in TypeScript I need to find out at runtime if a variable of type any implements an interface. Here's my code: interface A { member: string; } var a: any = { member: "foobar" }; if (a instanceof A)… Fix (from the top answer): You can achieve what you want without the instanceof keyword as you can write custom type guards now: interface A { member: string; } function instanceOfA(object: any): object is A { return 'member' in object; } var a: any Lots of Members If you need to check a lot of members to determine whether an object matches…
