Categories
Mastering Development

Webpack 5 + Angular 11 Error: ./node_modules/msnodesqlv8/build/Release/sqlserverv8.node 1:2

I’m using Webpack 5 and Angular 11 when I execute the command ng build –prod && ng run test-app:server:production In the console it gives me an error message: Error: ./node_modules/msnodesqlv8/build/Release/sqlserverv8.node 1:2 Module parse failed: Unexpected character ‘�’ (1:2) You may need an appropriate loader to handle this file type, currently no loaders are configured to […]

Categories
Mastering Development

Jest withTypeScript syntaxerror unexpected token, expected “;”

I’ve been trying to setup jest for use with typescript and I’ve tried a bunch of fixes with no luck. I’m getting the error SyntaxError: Unexpected token, expected ";", I think the config isn’t supporting typescript code: https://i.stack.imgur.com/iGBCa.png If anybody has any suggestions I’d be very grateful! Here’s my package.json: "jest": { "preset": "ts-jest", "testEnvironment": […]

Categories
Mastering Development

Cannot find ‘File’ type definitions Papaparse @types/papaparse

TS cannot find the File interface within the "@types/papaparse" module. I’d imagine that File is a Node type so I’m wondering if it’s maybe a TS setup issue. /node_modules/@types/papaparse/index.d.ts (23,25): Cannot find name ‘File’. /node_modules/@types/papaparse/index.d.ts (118,47): Cannot find name ‘File’. /node_modules/@types/papaparse/index.d.ts (119,38): Cannot find name ‘File’. /node_modules/@types/papaparse/index.d.ts /// <reference types="node" /> export as namespace Papa; […]

Categories
Mastering Development

TypeScript Appends export {} to end of file in TypeScript 4 but not TypeScript 3

I have an iife that I would like to compile and I import statement for types. In TypeScript version 3.* it compiles correctly. But in TypeScript version 4.* it appends an export {}. Is there a way to prevent that? Here is the typescript file test.ts: import { Tester } from "./tester" (async function test() […]

Categories
Mastering Development

‘ReactPlayer’ cannot be used as a JSX component

I attempt to use react-player for my React project. I’m using Typescript. I received the following error when I build it: ‘ReactPlayer’ cannot be used as a JSX component. Its instance type ‘ReactPlayer’ is not a valid JSX element. The types returned by ‘render()’ are incompatible between these types. Type ‘ReactNode’ is not assignable to […]

Categories
Mastering Development

CRA error – Cannot add property paths, object is not extensible

[debug: true] PS C:\data\test\todo> npm start > todo@0.1.0 start C:\data\test\todo > craco start craco: *** Cannot find ESLint loader (eslint-loader). *** Initial options: { "source": "tsconfig", "baseUrl": "./src", "tsConfigPath": "./tsconfig.extend.json", "debug": true } Normalized options: { "source": "tsconfig", "baseUrl": "./src", "tsConfigPath": "./tsconfig.extend.json", "debug": true } Aliases: { "@root": "C:\\data\\test\\todo\\src" } Webpack Config: { "react-native": "react-native-web", […]

Categories
Mastering Development

Typescript ignores decorated mobx properties on class type definition

This is a simplified example. I have a class definition using decorators like: export default class AnimationController { @observable animationTime: number = 0; @computed({keepAlive: true}) get interpolatedJoints(){} @computed({keepAlive: true}) get currentAnimation(){} } elsewhere I am importing this class to use as a type definition and getting an error when accessing these expected properties. import AnimationController […]

Categories
Mastering Development

typescript .d.ts file not recognized by typescript but vsc

Update: it isnt a typescript, but ts-node "issue" i answered to myself so if ure still interested in the "issue" – read further 🙂 sorry for the confusion maybe I have a TOTALLY wrong idea of the index.d.ts file.. but my idea was, that i can declare types within it and they are then "globally […]

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