typescript-typings Questions

3

I have a case where I'm frequently checking both the value of a boolean and another union type together. While they're logically connected and could hypothetically just check one, I need to check b...
Langston asked 3/11, 2021 at 20:5

5

When using react-hook-form with Typescript, there is a component that sends some props, register being one of them. The issue is with its type when declared in an interface: export interface MyProp...

3

I have some code that uses better-sqlite3 and I am trying to port it to typescript. Relevant parts of the original javascript code look like this: import Database from "better-sqlite3"; ...
Baroja asked 3/4, 2021 at 11:9

7

Solved

Is it possible to transform all the Date types definition from my interface to string, as it get automatically transformed to string on JSON stringify. interface Item { key: string; value: number...
Toronto asked 23/12, 2020 at 7:18

2

Solved

I have an icon-Map.json which is being created dynamically. Example: const iconMap = { angleDoubleRight: 'angleDoubleRight.svg', angleRight: 'angleRight.svg', assets: 'assets.svg', barChart: '...
Vala asked 5/6, 2019 at 10:50

7

Solved

I'm using clickOutside directive on my svelte-typescript project and I'm getting this error when I assign custom event to the related element Type '{ class: string; onclick_outside: () => boolea...
Greylag asked 30/9, 2020 at 4:59

3

Bun is currently working on my local machine, but I cannot get it to show all of the typings in my IDE. How do I set this up to work in VS Code and other editors?
Rooted asked 7/7, 2022 at 18:6

4

Solved

Using tsc v2.2.2 How to fix typescript compiler error: error TS4058: Return type of exported function has or is using name '{SomeInterface}' from external module "{some path}/dist/types" ...
Radish asked 11/4, 2017 at 1:32

5

The DefinitelyTyped definition of the Node built-in IncomingMessage (the type of req in the (req, res, next) arguments) has defined url to be nullable. Here's the snipped parts of the definition fi...
Ethelstan asked 1/11, 2016 at 23:30

3

I am trying to use perf_hooks from the nodeJS Performance API in my React Native project. Below is my code import {performance} from 'perf_hooks'; export const measure = ( target: Object, proper...

23

Even though I've installed & referenced the Typings library 'react' like this /// <reference path="../../../typings/browser.d.ts" /> I'm still getting the error below: Is there anothe...
Sixpence asked 7/6, 2016 at 8:17

8

I'm struggling to find the right type for this situation. This is a simplified version of redirecting after login. The following produces a compiler error: Property 'from' does not exist on type '...
Cristionna asked 7/5, 2020 at 22:12

2

Solved

I've been researching around for a further explanation into the skipLibCheck TypeScript compiler argument to determine the safety of having this set to true. The most in-depth explanation I found i...
Vestige asked 13/9, 2018 at 10:27

4

Solved

I've several .ts files + 1 entrypoint like so: classA.ts classB.ts entrypoint.ts entrypoint.ts contains something similar to: export * from './classA'; export * from './classB'; I'd like to ...
Apollonius asked 27/9, 2016 at 10:48

5

Solved

I'm writing the type definitions for a library I'm using. One function in the library identifies the mouse button clicked by an integer: //index.d.ts export as namespace myLib; // activates the...
Slaton asked 28/5, 2018 at 10:54

3

Solved

In redux-toolkit docs they suggest you to create the following definition to have proper types when you use useSelector hook: export const useAppSelector: TypedUseSelectorHook<RootState> = us...

5

I am using highland.js and have installed it with its type definition: jq .dependencies package.json | grep highland "@types/highland": "https://registry.npmjs.org/@types/highland/-/highland-1.14...
Octopod asked 14/12, 2016 at 14:21

3

Solved

Here is my current attempt on how to properly type a React ErrorBoundary class component in Typescript: import React from "react"; import ErrorPage from "./ErrorPage"; import ty...

3

Solved

I am using the Angular 4 CLI (v.1.0.0) and to handle testing I created some mocks that use jasmine to create a spy. In the IDE everything looks okay, however in the terminal I am getting and error ...
Cassella asked 21/4, 2017 at 20:49

6

Solved

When trying to extend the Request interface from the package express to add some custom properties, I'm getting the following typescript error: TS2339: Property '' does not exist on type 'Request&...
Kirchner asked 20/11, 2019 at 14:54

5

The req variable of Request type has no intellisense for property body. Is this due to the typings? import { Request, Response } from 'express' import { ok, bad } from './responses' export const ...

23

Solved

In my react and typescript app, I use: onChange={(e) => data.motto = (e.target as any).value} How do I correctly define the typings for the class, so I wouldn't have to hack my way around the t...
Gettings asked 18/11, 2016 at 11:46

9

Solved

My question is very brief. I am new to TypeScript, been searching around here and there but didn't find yet an answer. Does any experienced TypeScripter know if there is a character Type or an eas...
Logotype asked 8/3, 2017 at 18:16

7

Solved

Having compiled my TypeScript project successfully, I intended to run it in VS Code's debug mode using ts-node. Problem is, ts-node can't find d.ts files I created (while tsc has no problem with it...
Scherer asked 31/7, 2018 at 9:55

10

How to import CSS modules in Typescript with Webpack? Generate (or auto-generate) .d.ts files for CSS? And use classic Typescript import statement? With ./styles.css.d.ts: import * as styles fro...
Antimonic asked 26/12, 2016 at 22:22

© 2022 - 2025 — McMap. All rights reserved.