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

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

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

Categories
Mastering Development

Must I fix all TSLint errors before Angular production build?

I am able to run my Angular v8 app in development mode even there are TSlint TS errors (just showed few at below). However, when I try to build for production, it failed with npm ERR! code ELIFECYCLE npm ERR! errno 2. I have a number of TSlint TS errors, is there a way to […]

Categories
Development

Why is this React Typescript app throwing errors?

I just created a new React app using npx create-react-app my-app –template typescript and it was working fine until I changed my component to from a stateless one to a stateful one. The error: JSX element type ‘App’ is not a constructor function for JSX elements. TS2605 3 | import App from “./App”; 4 | […]

Categories
Development

How to stop TypeScript error ‘Type A has no properties in common with Type B’ when Type B “extends” Type A in some way

(edited Title to make more general) I’m working in a codebase which uses React class components and Typescript everywhere, and I’m trying to implement react-dropzone (a lightweight, simple but effective file-drop component) using the class-based method. The Hooks implementation is cleaner and simpler but I’d prefer to avoid so as to preserve the paradigm maintained […]

Categories
Development

Protractor – MacOS – SyntaxError: Unexpected token ‘export’

Hi everybody: I have some issues in Protractor. I’m new trying to config Protractor in Mac with VSCode (I couldn’t to that with Eclipse, it was really hard to do) I’m creating a project from the beginning with Protractor. I have created a conf.js file: export const config = { framework: ‘jasmine2’, specs: [‘specs/*.spec.js’], onPrepare: […]

Categories
Development

Report typescript errors as warnings in Visual Studio and don’t fail the build

I want to typecheck existing javascript code. To that end, I have specified the following tsconfig. Running tsc results in a couple of hundred errors, which show up in Visual Studio when I do a build. However those errors now also fail the build. As the code is currently functioning, I want to postpone resolving […]

Categories
Development

typescript cannot find module when import svg file

It’s web application created with Typescript, React and webpack. I want to use svg file through webpack. However, I got TS2307: Cannot find module ‘~/images/slide.svg’. Typescript files are put on /frontend/src/, and typescript files are build successfully. Then, I tried some solutions on website. But I could not solve this problem. What I tried is […]