TS2322: Type 'Redis' is not assignable to type 'RedisClient'. issue on Docker - node.js

I try to build an node.js app but I have an error like ;
=> ERROR [build 7/7] RUN npx nx build driver-api --prod 53.9s
------
> [build 7/7] RUN npx nx build driver-api --prod:
nx run driver-api:build:production
chunk (runtime: main) main.js (main) 348 KiB [entry] [rendered]
ERROR in /app/libs/database/src/lib/redis-pub-sub.provider.ts
./libs/database/src/lib/redis-pub-sub.provider.ts 16:10-19
[tsl] ERROR in /app/libs/database/src/lib/redis-pub-sub.provider.ts(16,11)
TS2322: Type 'Redis' is not assignable to type 'RedisClient'.
Type 'Redis' is missing the following properties from type 'Redis': stream, isCluster, connector, reconnectTimeout, and 140 more.
ERROR in /app/libs/database/src/lib/redis-pub-sub.provider.ts
./libs/database/src/lib/redis-pub-sub.provider.ts 17:10-20
[tsl] ERROR in /app/libs/database/src/lib/redis-pub-sub.provider.ts(17,11)
TS2322: Type 'Redis' is not assignable to type 'RedisClient'.
ERROR in libs/database/src/lib/redis-pub-sub.provider.ts:16:11
TS2322: Type 'Redis' is not assignable to type 'RedisClient'.
Type 'Redis' is missing the following properties from type 'Redis': stream, isCluster, connector, reconnectTimeout, and 140 more.
#12 53.66 14 | };
#12 53.66 15 | return new RedisPubSub({
#12 53.66 > 16 | publisher: new Redis(options),
#12 53.66 | ^^^^^^^^^
#12 53.66 17 | subscriber: new Redis(options),
#12 53.66 18 | })
#12 53.66 19 | } ,
#12 53.66
#12 53.66 ERROR in libs/database/src/lib/redis-pub-sub.provider.ts:17:11
#12 53.66 TS2322: Type 'Redis' is not assignable to type 'RedisClient'.
#12 53.66 15 | return new RedisPubSub({
#12 53.66 16 | publisher: new Redis(options),
#12 53.66 > 17 | subscriber: new Redis(options),
#12 53.66 | ^^^^^^^^^^
#12 53.66 18 | })
#12 53.66 19 | } ,
#12 53.66 20 | };
#12 53.66
#12 53.66 webpack compiled with 4 errors (b984ccb820b8363c)
my redis-pub-sub.provider.ts file like ;
import { pubSubToken } from '#nestjs-query/query-graphql';
import { RedisPubSub } from 'graphql-redis-subscriptions';
import Redis from 'ioredis';
import { Provider } from '#nestjs/common';
export class RedisPubSubProvider {
static provider(): Provider {
return {
provide: pubSubToken(),
useFactory: () => {
const options = {
host: process.env.REDIS_HOST || 'localhost',
port: 6379
};
return new RedisPubSub({
publisher: new Redis(options),
subscriber: new Redis(options),
})
} ,
};
}
}
how can I solve the issue ? can some one help me ?
when I try to build an node.js app I get an error like "TS2322: Type 'Redis' is not assignable to type 'RedisClient'. issue"

Related

React-Monaco Editor: Tree-Sitter resolution errors using NodeParserAdapter in React project

I'm trying to use the #cucumber/monaco editor library in a React project which uses tree-sitter for NodeParserAdapter but I'm getting a bunch of resolve errors in the tree-sitter when I do this. I'm importing the NodeParserAdapter, not the WasmParserAdapter from the cucumber/language-service as we aren't using WebAssembly in our project.
Environment: Node v16.17.1 (Docker Image 16.17)
Error Log:
[0]
[0] Search for the keywords to learn more about each warning.
[0] To ignore, add // eslint-disable-next-line to the line before.
[0]
[0] WARNING in ./node_modules/tree-sitter-c-sharp/bindings/node/index.js 2:2-77
[0] Module not found: Error: Can't resolve '../../build/Release/tree_sitter_c_sharp_binding' in '/usr/src/my_project/node_modules/tree-sitter-c-sharp/bindings/node'
[0]
[0] WARNING in ./node_modules/tree-sitter-c-sharp/bindings/node/index.js 9:4-77
[0] Module not found: Error: Can't resolve '../../build/Debug/tree_sitter_c_sharp_binding' in '/usr/src/my_project/node_modules/tree-sitter-c-sharp/bindings/node'
[0]
[0] WARNING in ./node_modules/tree-sitter-java/bindings/node/index.js 2:2-74
[0] Module not found: Error: Can't resolve '../../build/Release/tree_sitter_java_binding'
in '/usr/src/my_project/node_modules/tree-sitter-java/bindings/node'
[0]
[0] WARNING in ./node_modules/tree-sitter-java/bindings/node/index.js 9:4-74
[0] Module not found: Error: Can't resolve '../../build/Debug/tree_sitter_java_binding' in '/usr/src/my_project/node_modules/tree-sitter-java/bindings/node'
[0]
[0] WARNING in ./node_modules/tree-sitter-php/index.js 2:2-69
[0] Module not found: Error: Can't resolve './build/Release/tree_sitter_php_binding' in '/usr/src/my_project/node_modules/tree-sitter-php'
[0]
[0] WARNING in ./node_modules/tree-sitter-php/index.js 5:4-69
[0] Module not found: Error: Can't resolve './build/Debug/tree_sitter_php_binding' in '/usr/src/my_project/node_modules/tree-sitter-php'
[0]
[0] WARNING in ./node_modules/tree-sitter-python/bindings/node/index.js 2:2-76
[0] Module not found: Error: Can't resolve '../../build/Release/tree_sitter_python_binding' in '/usr/src/my_project/node_modules/tree-sitter-python/bindings/node'
[0]
[0] WARNING in ./node_modules/tree-sitter-python/bindings/node/index.js 9:4-76
[0] Module not found: Error: Can't resolve '../../build/Debug/tree_sitter_python_binding'
in '/usr/src/my_project/node_modules/tree-sitter-python/bindings/node'
[0]
[0] WARNING in ./node_modules/tree-sitter-ruby/bindings/node/index.js 2:2-74
[0] Module not found: Error: Can't resolve '../../build/Release/tree_sitter_ruby_binding'
in '/usr/src/my_project/node_modules/tree-sitter-ruby/bindings/node'
[0]
[0] WARNING in ./node_modules/tree-sitter-ruby/bindings/node/index.js 9:4-74
[0] Module not found: Error: Can't resolve '../../build/Debug/tree_sitter_ruby_binding' in '/usr/src/my_project/node_modules/tree-sitter-ruby/bindings/node'
[0]
[0] WARNING in ./node_modules/tree-sitter-typescript/bindings/node/index.js 2:2-80
[0] Module not found: Error: Can't resolve '../../build/Release/tree_sitter_typescript_binding' in '/usr/src/my_project/node_modules/tree-sitter-typescript/bindings/node'
[0]
[0] WARNING in ./node_modules/tree-sitter-typescript/bindings/node/index.js 9:4-80
[0] Module not found: Error: Can't resolve '../../build/Debug/tree_sitter_typescript_binding' in '/usr/src/my_project/node_modules/tree-sitter-typescript/bindings/node'
[0]
[0] WARNING in ./node_modules/tree-sitter/index.js 4:12-66
[0] Module not found: Error: Can't resolve './build/Release/tree_sitter_runtime_binding' in '/usr/src/my_project/node_modules/tree-sitter'
[0]
[0] WARNING in ./node_modules/tree-sitter/index.js 7:14-66
[0] Module not found: Error: Can't resolve './build/Debug/tree_sitter_runtime_binding' in
'/usr/src/my_project/node_modules/tree-sitter'
[0]
[0] webpack compiled with 14 warnings
Tree Sitter and the other tree-sitter-c-sharp, tree-sitter-java etc are all installed and in the node_modules directory of the project.
tree-sitter
tree-sitter-c-sharp
tree-sitter-cli
tree-sitter-java
tree-sitter-php
tree-sitter-python
tree-sitter-ruby
tree-sitter-typescript
And when I look in the tree-sitter/build/Release I can see the tree_sitter_runtime_binding.node file
root#abc123:/usr/src/my_project/node_modules/tree-sitter/build/Release# ls
obj.target tree_sitter.a tree_sitter_runtime_binding.node
So why can't tree-sitter resolve it?
Have tried Node 18, that didn't work, tried running the build command directly from the node_modules/tree-sitter directory, didn't work, have tried installing tree-sitter in a new folder on it's own and getting the same error. Any help much appreciated.
✅ What did you expect to see?
The tree-sitter package to resolve correctly and for the Monaco editor to work with the #cucumber/monaco library.
📦 Which tool/library version are you using?
+-- #cucumber/monaco#0.11.0
| +-- #cucumber/language-service#0.32.0
| | +-- #cucumber/cucumber-expressions#16.0.0
| | +-- #cucumber/gherkin-utils#8.0.0
| | +-- #cucumber/gherkin#24.0.0
| | +-- #cucumber/messages#19.1.4
| | +-- #types/js-search#1.4.0
| | +-- #types/mustache#4.2.1
| | +-- fuse.js#6.6.2
| | +-- js-search#2.0.0
| | +-- mustache#4.2.0
| | +-- tree-sitter-c-sharp#0.19.1
| | +-- tree-sitter-cli#0.20.6
| | +-- tree-sitter-java#0.19.1
| | +-- tree-sitter-php#0.19.0
| | +-- tree-sitter-python#0.20.1
| | +-- tree-sitter-ruby#0.19.0
| | +-- tree-sitter-typescript#0.20.1
| | +-- tree-sitter#0.20.0
| | +-- vscode-languageserver-types#3.17.2
| | `-- web-tree-sitter#0.20.5
| +-- monaco-editor#0.33.0
| `-- vscode-languageserver-types#3.17.2
Node.js 16.17.1, tried with later versions of Node but to no success.
React 18.2
🔬 How could we reproduce it?
Steps to reproduce the behavior:
Start a node:16.17 Docker container
Create a React project using the Create React App template
Install the Monaco editor library and #cucumber/monaco library
Create a TestEditor.jsx file
Import the NodeParserAdapter into the file
Bug should reproduce
Below is the code snippet I'm trying to run.
import React from 'react'
// Import the components
import VerticalNav from '../../components/navbar/VerticalNav'
import HorizontalNav from '../../components/navbar/HorizontalNav'
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api'
import MonacoEditor from '#monaco-editor/react'
import { configureMonaco } from '#cucumber/monaco'
import { ParameterTypeRegistry } from '#cucumber/cucumber-expressions'
import {
buildSuggestions,
ExpressionBuilder,
jsSearchIndex,
} from '#cucumber/language-service'
import { NodeParserAdapter } from '#cucumber/language-service/node'
import { render } from 'react-dom'
const value = `#foo
Feature: Hello
Scenario: Hi
Given I have 58 cukes in my belly
And this is an undefined step
| some | poorly |
| formatted | table |
`
async function Editor() {
monaco.languages.register({ id: 'typescript' })
const sources = [
{
languageName: 'java',
uri: 'file:///tmp/StepDefinitions.java',
content: `class StepDefinitions {
#Given("I have {int} cukes in my belly" )
void method1() {
}
#Given("there are {int} blind mice")
void method2() {
}
#Given("there is/are some/none/1 apple(s)")
void method2() {
}
}
`,
},
]
const adapter = new NodeParserAdapter('.')
await adapter.init()
const expressionBuilder = new ExpressionBuilder(adapter)
const { expressionLinks } = expressionBuilder.build(sources, [])
const expressions = expressionLinks.map((link) => link.expression)
const registry = new ParameterTypeRegistry()
const docs = buildSuggestions(
registry,
[
'I have 42 cukes in my belly',
'I have 96 cukes in my belly',
'there are 38 blind mice',
],
expressions,
)
const index = jsSearchIndex(docs)
return configureMonaco(monaco, index, expressions)
}
export default function EditorElement() {
const options = {
value,
language: 'gherkin',
theme: 'vs-dark',
// semantic tokens provider is disabled by default
'semanticHighlighting.enabled': true,
}
Editor()
.then((configureEditor) => {
// #ts-ignore
console.log('Hello World')
render(
<MonacoEditor
height="90vh"
options={options}
className="editor"
configure={configureEditor}
/>,
document.getElementById('editor'),
)
})
.catch((err) => console.error(err.stack))
return (
<>
<div className="flex">
<VerticalNav />
<div className="h-screen flex-1">
<HorizontalNav />
<div className="pt-9 w-[90%] m-auto">
<div id="editor"></div>
</div>
</div>
</div>
</>
)
}
I tried following the example in the try folder, just replacing the WasmParserAdapter with the NodeParserAdapter but then I couldn't get any further with the resolve errors.
Not sure if this is a problem with the tree-sitter library or a React project configuration problem. Tried a few solutions online but nothing seems to work. Any advice or help is much appreciated

How to resolve Mongod instance closed with code null

I am working on an application running on Ubuntu 20.04.4 and Node.js v14.19.3. It connects to MongoDB v3.6 on Docker.
While executing a jest test, it fails with the following error log:
FAIL src/user/user.service.spec.ts (8.555 s)
● Console
console.warn
Starting the instance failed, please enable debug for more infomation
at ../../../node_modules/mongodb-memory-server-core/src/MongoMemoryServer.ts:111:19
console.log
error closing connection to mongo: "Mongod instance closed with code \"null\""
at Object.<anonymous>.exports.closeInMongodConnection (utils/test-database.ts:24:15)
● UserService › should be defined
Failed: "Mongod instance closed with code \"null\""
15 | let connection: Connection
16 |
> 17 | beforeEach(async () => {
| ^
18 | const module: TestingModule = await Test.createTestingModule({
19 | imports: [
20 | rootMongooseTestModule(),
at Env.beforeEach (../../../node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:46:24)
at Suite.<anonymous> (user/user.service.spec.ts:17:3)
at Object.<anonymous> (user/user.service.spec.ts:13:1)
● UserService › should be defined
expect(received).toBeDefined()
Received: undefined
29 |
30 | it('should be defined', () => {
> 31 | expect(service).toBeDefined()
| ^
32 | })
33 |
34 | afterAll(async () => {
at Object.<anonymous> (user/user.service.spec.ts:31:21)
Any clue on 'Mongod instance closed with code "null"' is highly appreciated.

syn::Field.attrs doesn't contain inert attributes

Given the following struct definition:
#[derive(Builder)]
pub struct Command {
executable: String,
#[builder(each = "arg")]
args: Vec<String>,
#[builder(each = "env")]
env: Vec<String>,
current_dir: Option<String>,
}
(where the #[builder(...)] attributes are inert attributes defined by my Builder derive macro implementation),
the Builder macro cannot "see" the #[builder(...)] field attributes. The following code
let name = &f.ident;
let attrs = &f.attrs;
println!("Attributes: {:?}: {}", name, attrs.len());
(where f is a syn::Field) gives
Attributes: Some(Ident { ident: "executable", span: #0 bytes(2830..2840) }): 0
Attributes: Some(Ident { ident: "args", span: #0 bytes(2854..2858) }): 0
Attributes: Some(Ident { ident: "env", span: #0 bytes(2877..2880) }): 0
Attributes: Some(Ident { ident: "current_dir", span: #0 bytes(2899..2910) }): 0
(Full code: https://github.com/pdkovacs/forked-proc-macro-workshop/blob/a471007968f974ea3c1c684cc47a77fbd20b91dc/builder/src/lib.rs)
Can anybody help me find out what I am missing here, please?
I think you might just be interpreting the terminal output incorrectly since when I cloned your fork and removed the test code that failed to compile this is the output I got for the test with the attributes:
test tests/07-repeated-field.rs ... ok
WARNINGS:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
warning: unused import: `builder_trait:: Builder`
--> tests/07-repeated-field.rs:32:5
|
32 | use builder_trait:: Builder;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: 1 warning emitted
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
STDOUT:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
Attributes: Some(Ident { ident: "executable", span: #0 bytes(1471..1481) }): 0
Attributes: Some(Ident { ident: "args", span: #0 bytes(1524..1528) }): 1
Attributes: Some(Ident { ident: "env", span: #0 bytes(1576..1579) }): 1
Attributes: Some(Ident { ident: "current_dir", span: #0 bytes(1598..1609) }): 0
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
STDERR:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
warning: unused import: `builder_trait:: Builder`
--> /home/cassy/projects/forked-proc-macro-workshop/builder/tests/07-repeated-field.rs:32:5
|
32 | use builder_trait:: Builder;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
To be clear I completely commented out the body of main in 07-repeated-field.rs since it was failing to compile, and doing so allowed me to see this output.
I haven't used trybuild before but it seems like if a test fails to build then it doesn't give you the output from the proc macro invocation. Moreover it displays the STDOUT/STDERR of the test compilation process after it displays the test name, which likely was the source of the confusion.

Trying to generate production version of Express with Typescript

I'm getting this error below when I run: npm run clear && tsc -P ./tsconfig.app.json && npm run post:build or tsc -p .
node version: v12.13.0
npm: v6.14.2
Express: 4
Does someone already have the same problem?
> tsc -p .
node_modules/#types/readable-stream/index.d.ts:14:15 - error TS2417: Class static side 'typeof _Readable' incorrectly extends base class static side 'typeof Readable'.
The types of '(new Stream.Readable.Duplex(...))._destroy' are incompatible between these types.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
14 declare class _Readable extends stream.Readable {
~~~~~~~~~
node_modules/#types/readable-stream/index.d.ts:88:9 - error TS2416: Property '_destroy' in type 'Duplex' is not assignable to the same property in base type 'Duplex'.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
88 _destroy(err: Error | null, callback: (error: Error | null) => void): void;
~~~~~~~~
node_modules/#types/readable-stream/index.d.ts:88:9 - error TS2416: Property '_destroy' in type 'Duplex' is not assignable to the same property in base type 'Writable'.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
88 _destroy(err: Error | null, callback: (error: Error | null) => void): void;
~~~~~~~~
node_modules/#types/readable-stream/index.d.ts:88:9 - error TS2416: Property '_destroy' in type 'Duplex' is not assignable to the same property in base type '_Readable'.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
88 _destroy(err: Error | null, callback: (error: Error | null) => void): void;
~~~~~~~~
node_modules/#types/readable-stream/index.d.ts:102:11 - error TS2720: Class '_Readable.PassThrough' incorrectly implements class 'import("stream").PassThrough'. Did you mean to extend 'import("stream").PassThrough' and inherit its members as a subclass?
Types of property '_destroy' are incompatible.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
102 class PassThrough extends Transform implements stream.PassThrough {
~~~~~~~~~~~
node_modules/#types/readable-stream/index.d.ts:138:18 - error TS2749: 'StringDecoder' refers to a value, but is being used as a type here.
138 decoder: StringDecoder | null;
~~~~~~~~~~~~~
node_modules/#types/readable-stream/index.d.ts:164:11 - error TS2720: Class '_Readable.Transform' incorrectly implements class 'import("stream").Transform'. Did you mean to extend 'import("stream").Transform' and inherit its members as a subclass?
Types of property '_destroy' are incompatible.
Type '(err: Error | null, callback: (error: Error | null) => void) => void' is not assignable to type '(error: Error | null, callback: (error?: Error | undefined) => void) => void'.
Types of parameters 'callback' and 'callback' are incompatible.
Types of parameters 'error' and 'error' are incompatible.
Type 'Error | null' is not assignable to type 'Error | undefined'.
Type 'null' is not assignable to type 'Error | undefined'.
164 class Transform extends Duplex implements stream.Transform {
~~~~~~~~~
Found 7 errors.
Try adding
"#types/node": "^12.12.7"
to devDependencies in package.json. then,
npm install
It worked for me. Cheers!!

How do I use local TypeScript with npm on an isolated file in a larger project?

I have an Expo TypeScript project with some scratch TypeScript files that I would like to test by running tsc (and then node on the emitted JS). But doing so results in unexpected errors, and fails to report legitimate expected TS errors.
I have a (correctly, I believe) configured TypeScript locally installed with npm, as confirmed by
$ ./node_modules/typescript/bin/tsc --version
Version 3.5.3
but when I try use tsc on a TypeScript file I get unexpected errors, such as those listed below following execution of
npx tsc somefile.ts
Moreover, tsc (at least when invoked as above) fails to emit any expected errors or compiler warnings, such as should be generated from, for example
let foo: number = 5
foo = null
Nonetheless, the expected _somefile.js is generated and runs as expected (ignoring errors).
How do I get tsc to detect errors in my .ts file, and avoid having it report numerous errors in other modules associated with my project installation?
Output from npx tsc somefile.ts, abbreviated:
node_modules/#types/react-native/globals.d.ts:40:15 - error TS2300: Duplicate identifier 'FormData'.
40 declare class FormData {
~~~~~~~~
node_modules/typescript/lib/lib.dom.d.ts:5353:11
5353 interface FormData {
~~~~~~~~
'FormData' was also declared here.
node_modules/typescript/lib/lib.dom.d.ts:5363:13
5363 declare var FormData: {
~~~~~~~~
and here.
node_modules/#types/react-native/globals.d.ts:85:5 - error TS2717: Subsequent property declarations must have the same type. Property 'body' must be of type 'BodyInit', but here has type 'string | ArrayBuffer | DataView | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | Blob | FormData'.
85 body?: BodyInit_;
~~~~
node_modules/typescript/lib/lib.dom.d.ts:1413:5
1413 body?: BodyInit | null;
~~~~
'body' was also declared here.
node_modules/#types/react-native/globals.d.ts:111:14 - error TS2300: Duplicate identifier 'RequestInfo'.
111 declare type RequestInfo = Request | string;
~~~~~~~~~~~
node_modules/typescript/lib/lib.dom.d.ts:18568:6
18568 type RequestInfo = Request | string;
~~~~~~~~~~~
'RequestInfo' was also declared here.
node_modules/#types/react-native/globals.d.ts:130:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'Response' must be of type '{ new (body?: BodyInit, init?: ResponseInit): Response; prototype: Response; error(): Response; redirect(url: string, status?: number): Response; }', but here has type '{ new (body?: string | ArrayBuffer | DataView | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | Blob | FormData, init?: ResponseInit): Response; prototype: Response; error: () => Response; redirect: (url: string, status?: number) => Res...'.
130 declare var Response: {
~~~~~~~~
node_modules/typescript/lib/lib.dom.d.ts:12463:13
12463 declare var Response: {
~~~~~~~~
'Response' was also declared here.
node_modules/#types/react-native/globals.d.ts:253:14 - error TS2300: Duplicate identifier 'XMLHttpRequestResponseType'.
253 declare type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text";
~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/typescript/lib/lib.dom.d.ts:18746:6
18746 type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text";
~~~~~~~~~~~~~~~~~~~~~~~~~~
'XMLHttpRequestResponseType' was also declared here.
[...]
node_modules/typescript/lib/lib.dom.d.ts:18746:6 - error TS2300: Duplicate identifier 'XMLHttpRequestResponseType'.
18746 type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text";
~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/#types/react-native/globals.d.ts:253:14
253 declare type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text";
~~~~~~~~~~~~~~~~~~~~~~~~~~
'XMLHttpRequestResponseType' was also declared here.
Found 12 errors.
Contents of tsconfig.json:
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"jsx": "react-native",
"lib": ["dom", "esnext"],
"moduleResolution": "node",
"noEmit": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true
}
}
The dependences in project.json:
"dependencies": {
"expo": "^34.0.4",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
"react-native-web": "^0.11.5",
"native-base": "^2.13.4",
"redux": "^4.0.4",
"react-redux": "^7.1.0"
},
These errors occur because both React Native and the standard dom modules define the same types.
Delete whichever of those you aren't using.

Resources