Category "typescript"

Is it possible to use a property whose type is specified in Generics in a function?

const func = <T extends object, S extends keyof PickByValue<T, string>>( obj: T, key: S ): string => { return obj[key]; }; PickByValue ext

Type 'StaticImageData' is not assignable to type 'string'

I'm struggling with interfaces on my little learning NextJS and TypeScript project. I thought I had it sorted out but am dealing with an issue on my Header.tsx

how to render toastr within angular?

How do you import toastr into an angular app? I'm following the Angular Fundamentals course, and attempting to simply display toastr.success from within my exp

Angular strongly typed reactive forms

I'm looking to refactor a large set of components in my Angular project to have strongly typed FormGroups, FormArrays, and FormControls. I'm just looking for a

EmailJS - Vue.js 2 and TS

I'm sorry, but I didn't find some similar issue on the web Here is my problem, I tried to make a form to get contacted from an app. I code with Vue.js 2 and Typ

TS2307: Cannot find module 'class-validator'

I'm attempting to use the class-validator module in a typescript project. However when I compile typescript issues the following warning: src/main/ts/domain/O

StyledComponents with Typescript and ThemeProvider. What are the right types?

I have problems to get the right types when using StyledComponents with ThemeProvider. I have tried it with this approach: https://github.com/styled-components/

The return type of an async function must be the global Promise<T> type

Why does TSlint still says "The return type of an async function or method must be the global Promise type"? I can't understand what's wrong. UPDATED:

How to change results as far as I move map in react-instantsearch-dom-maps

I am currently working with algolia and I have some strange issue with the map. I have this interface (left column is results, right column is map) like on this

Angular dynamic template rendering like ui grid cell template (template declared in colDefs of parent)

Angular (7) dynamic template (ng-template) rendering like ui grid cell template (template declared in colDefs of parent); I tried in so many ways since more tha

Types for tailwind

I am using tailwind.config.js in order to extend some colors: const theme = { mode: 'jit', content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'], darkMo

Types for tailwind

I am using tailwind.config.js in order to extend some colors: const theme = { mode: 'jit', content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'], darkMo

Vendor Machine API's Postman Collection Issue

I am trying to create a postman collection for a Vendor machine API but when I try to send a login request localhost:3000/auth/login I get connect ECONNREFUSED

Make a single property optional in TypeScript

In TypeScript, 2.2... Let's say I have a Person type: interface Person { name: string; hometown: string; nickname: string; } And I'd like to create a

Spy on the result of an Observable Subscription with Jasmine

I am Jasmine unit testing an angular component, which uses Observables. My component has this lifecycle hook that I am testing: ngOnInit() { this.dataService.

Error: Child Compilation failed - Module.createRequire is not a function

I have worked on a React/Typescript application on my Mac Machine, and zipped up the application (including node_modules) and emailed it to a colleague via Goog

An index signature parameter type cannot be a union type. Consider using a mapped object type instead

I'm trying to use the following pattern: enum Option { ONE = 'one', TWO = 'two', THREE = 'three' } interface OptionRequirement { someBool: boolean;

Type 'FileOriginal' is not assignable to type 'Provider' when trying to use Native File in Ionic

I'm attempting to use PDFMaker for my Ionic 5 project. 1 prerequisite is to use the Native File and FileOpener. When I try to import the module, I get the below

make .d.ts for external library file available for project

I have a closed-source plain JS library that will be included via a <script> tag pointing to a CDN. I would like to author my own type definition file for

How to add multiple components into one story using Storybook?

I just started using storybook, and I need your help. I've four components for the different icons, and I want to create one story for all of them instead of cr