Blockly version 8 won't compile with TypeScript without skipLibCheck

244 views
Skip to first unread message

Johnny Oshika

unread,
May 6, 2022, 2:15:55 AM5/6/22
to Blockly
I'm running Blockly in a headless environment and compiling my project with TypeScript. Since upgrading from blo...@6.20210701.0 to blo...@8.0.1, my project won't compile unless I ask my compiler to skip type checking all of my libraries by adding "skipLibCheck": true to my tsconfig.json.

Here's the error message:

167075373-b2ac3360-a2f8-4ce5-b553-214fca61ba93.png

If I add "skipLibCheck": true, then everything compiles fine, but then I lose type system accuracy with all of my other libraries.

I created a simple repository to demonstrate this problem: https://github.com/johnnyoshika/blockly-typescript-libcheck

How is everyone else overcoming this problem?

Johnny Oshika

unread,
May 6, 2022, 2:17:41 AM5/6/22
to Blockly
That screenshot of the error messages is hard to read, so here it is again:


node_modules/blockly/blocks.d.ts:14:26 - error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'allowSyntheticDefaultImports' flag and referencing its default export.

14 import * as Blockly from './core';
                            ~~~~~~~~

node_modules/blockly/core.d.ts:14:13 - error TS2303: Circular definition of import alias 'Blockly'.

14 import * as Blockly from 'blockly';
               ~~~~~~~

node_modules/blockly/core.d.ts:14:26 - error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'allowSyntheticDefaultImports' flag and referencing its default export.

14 import * as Blockly from 'blockly';
                            ~~~~~~~~~

node_modules/blockly/index.d.ts:17:26 - error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'allowSyntheticDefaultImports' flag and referencing its default export.

17 import * as Blockly from './core';
                            ~~~~~~~~

node_modules/blockly/javascript.d.ts:14:26 - error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'allowSyntheticDefaultImports' flag and referencing its default export.

14 import * as Blockly from './core';
                            ~~~~~~~~


Found 5 errors in 4 files.

Errors  Files
     1  node_modules/blockly/blocks.d.ts:14
     2  node_modules/blockly/core.d.ts:14
     1  node_modules/blockly/index.d.ts:17
     1  node_modules/blockly/javascript.d.ts:14


Beka Westberg

unread,
May 6, 2022, 10:23:23 AM5/6/22
to blo...@googlegroups.com
Hello,

Thank you for reporting this! I've filed an issue to track getting it fixed. If you have any further information, feel free to add it there =)

Best wishes,
--Beka

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/e6803543-9b55-49e2-bf4e-e870076eb972n%40googlegroups.com.

Johnny Oshika

unread,
May 7, 2022, 12:32:42 AM5/7/22
to Blockly
That's great, thank you Beka! I subscribed to that issue.
Reply all
Reply to author
Forward
0 new messages