Category: TypeScript

  • Wrap useQuery of tRPC in a custom hook with correct TypeScript types

    Wrap useQuery of tRPC in a custom hook with correct TypeScript types If you are using tRPC, a TypeScript-first framework for building scalable APIs, you might have come across the need to wrap the useQuery function in a custom hook with correct TypeScript types. In this blog post, we will explore different solutions to achieve…

  • How can I write this function signature in typescript?

    How can I write this function signature in TypeScript? When working with TypeScript, you may come across situations where you need to define function signatures. Function signatures allow you to specify the types of the parameters and the return type of a function. This helps in providing type safety and enables better code organization and…

  • Typescript @ts-ignore/@ts-expect-error hinder excessive property checks on literals

    Typescript @ts-ignore/@ts-expect-error hinder excessive property checks on literals When working with TypeScript, it’s common to come across scenarios where you want to ignore or expect errors for certain properties on literals. This can be useful when dealing with external libraries or when you know that a particular property will not be present at runtime. In…

  • In TypeScript limit a generic to list of dot notation keys

    In TypeScript limit a generic to list of dot notation keys When working with TypeScript, you may come across a situation where you want to limit a generic type to a specific set of dot notation keys. This can be useful when you want to ensure that only certain properties are allowed to be accessed…

  • How to type CSS Float using typescript?

    How to Type CSS Float Using TypeScript? If you are working with TypeScript and need to type CSS float, you may have encountered some challenges. In this blog post, we will explore different solutions to type CSS float using TypeScript. Solution 1: Using Union Types One way to type CSS float in TypeScript is by…

  • Angular/Typescript declared property links to service, but ‘used before its initialization’ error

    Angular/Typescript declared property links to service, but ‘used before its initialization’ error When working with Angular and TypeScript, you may encounter an error message stating ‘used before its initialization’ when trying to access a property that is linked to a service. This error occurs when the property is accessed before it has been initialized, causing…

  • TypeScript version mismatch error: TS2304 (TS) Cannot find name ‘ExtendableEvent’

    TypeScript version mismatch error: TS2304 (TS) Cannot find name ‘ExtendableEvent’ If you are working with TypeScript and encounter the error message “TS2304 (TS) Cannot find name ‘ExtendableEvent’”, it means that there is a version mismatch between the TypeScript compiler and the TypeScript declaration files you are using. This error often occurs when you are using…

  • How to connect smb server with typescript

    How to Connect SMB Server with TypeScript If you are working with TypeScript and need to connect to an SMB (Server Message Block) server, you may be wondering how to accomplish this task. In this blog post, we will explore different solutions to connect to an SMB server using TypeScript. Solution 1: Using the ‘smb2’…

  • How to Properly Type Supabase Responses When Using JOIN Operations in TypeScript?

    How to Properly Type Supabase Responses When Using JOIN Operations in TypeScript? Supabase is a powerful open-source alternative to Firebase that provides a real-time database and authentication system. When working with Supabase and TypeScript, you may come across a situation where you need to perform JOIN operations on your database tables. In this blog post,…

  • How to improve performance in mapped types in TypeScript

    How to Improve Performance in Mapped Types in TypeScript When working with TypeScript, you may come across scenarios where you need to transform or manipulate types using mapped types. While mapped types are powerful and flexible, they can sometimes lead to performance issues, especially when dealing with large and complex types. In this article, we…