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

Webpack – import const from .d.ts file not working – Can’t resolve ‘@nuvolo/servicenow-types/server/GlideRecord’

I’m doing this: import { GlideRecord } from "@nuvolo/servicenow-types/server/GlideRecord"; I have a file node_modules/@nuvolo/servicenow-types/server/GlideRecord.d.ts It contains: … type GlideRecordConstructor = { new <T>(table: string): GlideRecord<T> }; type GlideRecord<T> = GlideRecordBase<T> & T; declare const GlideRecord: GlideRecordConstructor; export { GlideRecord }; If I run tsc it works, no errors Webpack says: Module not found: Error: Can’t […]

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

Is it possible to configure wdio to make use of different tsconfig files?

I’m trying to get wdio setup to run our React TypeScript app. The problem is that it only works if I modify the tsconfig.json file itself to make use of the required types, change module to commonjs and set isolatedModules to false: { "compilerOptions": { "target": "es5", "lib": [ "dom", "dom.iterable", "esnext" ], "allowJs": true, […]

Categories
Mastering Development

Typescript + Electron + ThreeJS Import Module converts to require

I am building a 3D multiplatform electron app bundled around photoshop with vscode, electron, typescript,electron packager,npm, threejs on windows. Unfortunately, Typescript works a little against me. Whenever I compile to js it replaces import {x} from "./y" with an unnecessary require(y) and some export stuff above it. This is the index.html: <!DOCTYPE html> <html> <head> […]

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 : […]