Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [.d.ts]

.d.ts is commonly used to define a typescript declaration file containing definitions for properties and functions. This gives the benefit to an IDE allowing it to provide intellisense and proper error messages when the declaration file is not adhered to.

1 vote
0 answers
20 views

Can I get the name of a TypeScript class or function at compile-time? [duplicate]

I'm trying to transform a JavaScript class which dynamically manages other classes for use in a web-based game engine into a TypeScript class for proper type checking (or, more accurately, write a .d....
Simon Struthers's user avatar
0 votes
0 answers
19 views

TypeScript project can't find UMD module during import

I created a library of React components built with TypeScript and compiled into UMD using Webpack. When I try to import one of those components into a separate TypeScript project, I get the following ...
robbymarston's user avatar
0 votes
0 answers
27 views

pixi.js imports don't work in the index.d.ts file

I'm creating a library using typescript and pixi.js. when i build the library i create also all the *.d.ts files and i merge all those files in only one index.d.ts file using "dts-bundle". ...
Romiar's user avatar
  • 1
0 votes
1 answer
76 views

Create declaration file for third party library as CJS

I am using a third party CommonJS (CJS) library without types. My project is CJS with TypeScript. The importation works just fine (imports are transpiled to requires) if I disable errors using ...
myol's user avatar
  • 9,527
1 vote
1 answer
41 views

how to create d.ts type definition of existing Context module?

I have a hybrid project that uses js and tsx/ts files. File 1 is called form.js and I am exporting a context module: const FormContext = React.createContext({}) .... When I try to access the values/...
Vania Oliveira's user avatar
1 vote
1 answer
145 views

Why is my custom .d.ts not working? LeaderLine is not a constructor

I want to add typings to the leader-line library, but I keep getting the error TypeError: leader_line_1.LeaderLine is not a constructor I am sure it's just one small thing / concept I am overlooking ...
Tucaen's user avatar
  • 113
0 votes
0 answers
53 views

TypeScript global.d.ts module declaration is overriding entire @mui/material module when trying to fix theming issue

This issue stems from trying to set the main property on MUIs palette (themeConfig.palette.primary.main = brandColor). This produces the following error: Property 'main' does not exist on type '...
Tim DiRusso's user avatar
1 vote
3 answers
863 views

How to use custom global declaration in NextJS 14

I want to use custom global declaration in NextJS I have a NextJS project in which I have created a global prototype to String like below utils.d.ts export {} declare global { interface String { ...
Vinod Kumar's user avatar
0 votes
0 answers
36 views

How to prevent tsc to generate unused declaration files given a single entry file

Given this tsconfig.json { "compilerOptions": { "declaration": true, "emitDeclarationOnly": true, "outDir": "./dist", "rootDir&...
kitta's user avatar
  • 1,989
0 votes
1 answer
771 views

Import .d.ts in ts file

I have an issue. I am trying to import some types from a .d.ts file that I have created but ts shows error on the path of the file with message: File '.../lib/types/generated.d.ts' is not a module.ts(...
Dionysis Balaskas's user avatar
0 votes
0 answers
162 views

i18next typescript false warning on t function

I'm trying to make react-i18next work with typescript, but I'm having a typescript warning on my editor even when the code is working fine. The error: Argument of type '["button.add"]' is ...
ngtrthinh's user avatar
  • 137
0 votes
1 answer
202 views

Cannot find module svg with typescript on create-react-app even with custom.d.ts

There's a lot of almost similar questions but I still can't find anything that works. For context: I'm using CRA app with js template and migrated to ts after. The SVG is working ok, so it's likely to ...
ngtrthinh's user avatar
  • 137
0 votes
0 answers
29 views

Trying to create a .D.TS file based on custom API library

So, I work on platform that leverages it's own OOP API library based on JavaScript. The main object is called "controller" and is passed in a functioned called "run". From there ...
user2677071's user avatar
0 votes
0 answers
348 views

Using Tailwind resolveConfig with Typescript with Proper Types

I am trying to use resolveConfig in my code. I have a turbo repo and this is the structure of my tailwind config directory: packages/configs/ ├── package.json ├── tailwind │ ├── postcss.config.js │ ...
Vipul Rajan's user avatar
0 votes
0 answers
23 views

Convenient way to suppress generation of d.ts files that contain only `export {};`?

In my project I have e.g. index.ts with a bunch of exported functions and I certainly want tsc to generate the d.ts files for ones like that. But I also have e.g. a bunch of examples of using the ...
Glen Whitney's user avatar

15 30 50 per page