Category "typescript"

How to include a global file type declaration in a TypeScript (Node.js) package

I'm working on a package that I am planning to publish publicly on npmjs. Let's call it the "text package". I would like that by default when installing that pa

How to build a TypeScript class constructor with object defining class fields?

In TypeScript it's possible to create a class with a constructor that takes parameter with access modifiers and it automatically convert those parameters in cla

Why are logical assignment (&=) operators disallowed in Typescript?

With the following code: var x:boolean = true; x &= false; Results in error TS2447: The '&=' operator is not allowed for boolean types. Consider usi

Object is possibly 'null' (undefined)

See, this is my code and it is saying few errors, which are: Object is possibly 'null', Property 'style' does not exist on type 'Element'. It is very irritating

NestJS and Serverless - handler 'handler' is not a function

I am trying to implement NestJS as a AWS Serverless function using serverless-framework. I was following this official documentation and my code is exactly as i

Resolve Error: typescript with invalid interface loaded as resolver ESLint

I'm having ESLint in my project and getting an error Resolve Error: typescript with invalid interface loaded as resolver : import-no-restricted-paths when I ad

How do I compile Typescript at Heroku postinstall?

Instead of uploading the precompiled dist directory, I want to compile src at server side instead. Here are my scripts inside package.json: "scripts": { "

How to fix NextJS webpack error: You may need an appropriate loader to handle this file type, currently no loaders are configured

I generated NextJS project using TypeScript template and I want to add my Storybook to the project. Storybook is written in TypeScript. When I'm adding Storyboo

Typescript: add instance of external dependency to window object

I am integrating an external dependency into an Enterprise project. The integration goes like this: window.foo = new Foo({ container: `#${iframeContainer

How to break/continue across nested for each loops in TypeScript

I tried to use break inside nested for each loop and it says jump target cannot cross function boundary. please let me know how can i break nested for each loop

ERROR TypeError: Cannot read property 'slice' of undefined---Typescript

how are you? I have one problem 'slice' of undefined in my project. I use autocomplete material https://material.angular.io/components/autocomplete/examples M

Is there anyway to get types interfaces for request, response in Nest.js with Fastify

I am learing Nest.js and on the beging of documentation I read that I can use it not only with express but also with fastify so I setuped up my first project wi

NestJS Share e2e server between test suites

I'm using NestJS test module to mock the nest app and I want to share this app among various test suites. Here's my setup: test |_ helpers |_ testApp.ts

ESLint configuration with typescript jsx

I am having issues with configuration with typescript. Here is my following code in tsconfig.json: { "compilerOptions": { "target": "es5", "lib": [

Consider using the "jsdom" test environment

I have this simple test: import React from 'react' import { render } from '@testing-library/react' import Button from '.' describe('Button', () => { it('

Typescript: deep keyof of a nested object

So I would like to find a way to have all the keys of a nested object. I have a generic type that take a type in parameter. My goal is to get all the keys of

does native-base have a utility method that allows us to extract computed theme data?

I am using native base and I want to use some of the theme values for example the primary text color and the main background color I am looking for something th

Rollup & Typescript type declarations with absolute imports

I'm making React component library. Project structure is something like: src/ components/ utils/ hooks/ Now I'm trying to generate types (.d.ts.) file

Type 'Element[]' is missing the following properties from type 'Element': type, props, key

I have the standard arrow map ES7 function with Typescript and React environment: const getItemList: Function = (groups: any[]): JSX.Element => group.ma

Default values for optional parameters in options argument

I want to pass an object as argument for the constructor of a class. Some keys of the options object are optional. Is there a better / more idiomatic way of ac