react-ace icon indicating copy to clipboard operation
react-ace copied to clipboard

TS error in VirtualRenderer interface

Open artsiadi opened this issue 3 years ago • 7 comments

Getting the following error in version 1.5.3 of ace-builds.

node_modules/react-ace/lib/types.d.ts:124:11 - error TS2430: Interface 'IRenderer' incorrectly extends interface 'VirtualRenderer'. Types of property 'scroller' are incompatible. Type 'HTMLDivElement | undefined' is not assignable to type 'HTMLElement'. Type 'undefined' is not assignable to type 'HTMLElement'.

124 interface IRenderer extends Ace.VirtualRenderer { Found 1 error in node_modules/react-ace/lib/types.d.ts:124

Fixed by downgrade to version 1.5.0 of ace-builds.

artsiadi avatar Jun 01 '22 07:06 artsiadi

I tried doing this (downgrading to v1.5.0), but it did not fix the issue for me. I'm getting the same error. Can someone please help me out?

lekha-badarinath avatar Jun 07 '22 11:06 lekha-badarinath

Having the same problem with ace-builds v1.6.0 (Typescript project)

node_modules/react-ace/lib/types.d.ts:124:11 - error TS2430: Interface 'IRenderer' incorrectly extends interface 'VirtualRenderer'.
  Property 'scroller' is optional in type 'IRenderer' but required in type 'VirtualRenderer'.

I believe this dependabot PR is related https://github.com/securingsincity/react-ace/pull/1559

BALEHOK avatar Jun 17 '22 16:06 BALEHOK

By the way this is happening with skipLibCheck: false. Setting it to true makes it work, however now your d.ts files aren't checked anymore (if you're using any)

fregante avatar Jul 25 '22 07:07 fregante

I'm having the same error. Will this be addressed any time soon?

ryan0122 avatar Aug 26 '22 05:08 ryan0122

Also having this problem with typescript (using next.js too).

Downgrading to ace-builds to 1.5.0 didn't fix the error, nor did setting skipLibCheck: true in .tsconfig (next.js sets this by default, actually).

Any solutions in the pipes?

isvidler avatar Sep 22 '22 15:09 isvidler

skipLibCheck: true in .tsconfig does work for React apps without downgrading ace-builds. Should be a good resolution till they provide a fix.

Tak1za avatar Oct 15 '22 15:10 Tak1za

In our project we patched the type since its such simple fix, would be nice if it would get fixed for real tho

Here is the diff that solved my problem:

diff --git a/node_modules/react-ace/lib/types.d.ts b/node_modules/react-ace/lib/types.d.ts
index 3fbd75b..569482c 100644
--- a/node_modules/react-ace/lib/types.d.ts
+++ b/node_modules/react-ace/lib/types.d.ts
@@ -123,7 +123,7 @@ export interface IAnnotation {
 }
 interface IRenderer extends Ace.VirtualRenderer {
     placeholderNode?: HTMLDivElement;
-    scroller?: HTMLDivElement;
+    scroller: HTMLDivElement;
 }
 export declare type IAceEditor = Ace.Editor & {
     renderer: IRenderer;

This diff was generated by patch-package.

Stainless2k avatar Dec 08 '22 13:12 Stainless2k