Categories
Mastering Development

How to configure stencil so that generated ts file doesnt come with double quotes

Right now whenever I ran command stencil build –docs, it will generate components.d.ts with below content /* eslint-disable */ /* tslint:disable */ /** * This is an autogenerated file created by the Stencil compiler. * It contains typing information for all components that exist in this project. */ import { HTMLStencilElement, JSXBase } from "@stencil/core/internal"; […]

Categories
Mastering Development

Type declaration error despite adding .d.ts file

I am using a npm package called update-immutable which happens to not have a typescript definition available built in or by @types. So I created a type definition file in my project and now VS Code detects the proper types for this package. However with noImplicitAny option set to true, Angular’s compiler doesn’t seem to […]

Categories
Mastering Development

How to enable @ experimentalDecorators in next.config.js or babelrc

Hi if someone would help me, I wanna use @Decorators on my nextjs app, but I get the following error. Hope someone knows what Im doin wrong Error message: Syntax error: Support for the experimental syntax ‘decorators-legacy’ isn’t currently enabled: I’m trying to use typeorm / type-graphql to generate my backend in an app subfolder. […]

Categories
Mastering Development

Cannot find module ‘class-transformer’ or its corresponding type declarations

I am trying to use the class-transformer package with NestJS v7. The class-transformer package was installed with npm i class-transformer –save. I’ve followed instructions as per readme.md This package does have a typescript definition, I can see it on my filesystem (in the correct directory inside node_modules), VS Code navigates to the definition just fine, […]

Categories
Mastering Development

A type error in WorkBox routing when defining HeadersInit value

I’m currently trying to create a Service Worker with TypeScript and WorkBox. The following is my current WorkBox definition (just to get something going). How could I solve the type error that I explain the following? In the registerRoute piece TypeScript compiler tells that matchPrecache expect two parameters, the other being of type HeadersInit. If […]

Categories
Mastering Development

Unable to load preload script – Electron.js Ubuntu 18.04.4

I’m trying to understand how to effectively load the proload.js file in electron: Version "electron": "^9.1.2", Version "electron-builder": "^22.8.0", In background.js I put webPreferences: { nodeIntegration: false, contextIsolation: true, //preload: path.join(app.getAppPath(), "preload.js"), preload: path.join(__dirname, "./preload.js"), }, preload.js and background.js are in the same folder: src folder. this is my preload.js : const { contextBridge, ipcRenderer […]

Categories
Mastering Development

while ionic serve I’m getting this error “typescript: node_modules/@types/node/worker_threads.d.ts, line: 8 ‘=’ expected. “

My ionic info: cli packages: (/usr/local/lib/node_modules) @ionic/cli-utils : 1.9.0 ionic (Ionic CLI) : 3.9.0 global packages: Cordova CLI : 9.0.0 (cordova-lib@9.0.1) local packages: @ionic/app-scripts : 3.2.4 Cordova Platforms : android 7.1.4 browser 5.0.3 Ionic Framework : ionic-angular 3.9.2 System: Android SDK Tools : 26.1.1 ios-deploy : 1.10.0 Node : v10.13.0 npm : 6.4.1 OS : […]

Categories
Mastering Development

Angular 10: Path Mapping shows error in VSCode when import

So I updated a project that was in Angular 8.2 (a project template) to version 10 and followed the instructions from https://update.angular.io/ and everything was ok, but when implemented Path Mapping the pain started, I’m getting this error everywhere: Cannot find module ‘@environments/environment’ or its corresponding type declarations.ts(2307) And this error applies to @environments and […]

Categories
Mastering Development

Property ‘toBeInTheDocument’ does not exist on type ‘Matchers

Trying to setup testing for a components library. I’ve tried many example and all similar threads on this with no luck. My setupTests.ts file is correctly being loaded (proven with a console.log), and the library seems to be available as if I add import { toBeInTheDocument } from ‘@testing-library/jest-dom/matchers’ and log toBeInTheDocument it is present. […]

Categories
Mastering Development

Issue trying to setup jest: application code compiles fine but test code doesn’t

I am trying to migrate to jest and I am facing typescript issues… I have 3 tsconfig files: tsconfig.json (base config) tsconfig.lib.json (application config) tsconfig.jest-spec.json (jest-dedicated test config) Please note that there are also karma/jasmine dedicated tsconfig files but those are irrelevant. I have separated the jest tests from the karma ones. tsconfig.json { "compileOnSave": […]