Comments (10)
The simplest way to fix this issue is to set the compilerOption "esModuleInterop": true
in your tsconfig.json.
The modules fast-diff and quill-delta are exported using export =
because this is the only way they can be backwards-compatible with CommonJS require statements like const diff = require('fast-diff')
.
Using Babel, you can then write import diff from 'fast-diff'
because of Babel's module interop behavior. TypeScript originally did not have this interop, forcing you to write import diff = require('fast-diff')
, but this is ugly, and they changed their mind in 2.7 to be like Babel. They put the new behavior behind a flag because it is breaking, but they "highly recommend" you use the new behavior.
We could change Delta.ts to say import diff =
, but the point of TypeScript's change to module interop is that no one should have to type that anymore, so let me know if turning on the new module interop isn't a valid solution for you.
from delta.
for anyone coming through this problem, i believe the actual solution is not to mess with the compiler options but just to be careful with dependencies versions.
If you use Quill, the default version is a v1.x.
but the default @type/quill version is a v2.x.
juste use a @type/quill v1.x and everything will be all right ;)
from delta.
I'm on Angular 9
with:
"quill": "1.3.7",
"@types/quill": "1.3.10",
Works fine, but when I update @types/quill
to version 2.0.3
I get the above-mentioned-error 🤷♂️
from delta.
file: node_modules\fast-diff\diff.d.ts (line number 20) export = diff
to export default diff
file: node_modules\quill-delta\dist\Delta.d.ts (line number 32) export = Delta;
to export default Delta
will solve the issue. Working well for me now.
from delta.
I have the same error when I try to
yarn add react-quill
I'm using React and Typescript
it seems to be coming from Delta.d.ts
How can I resolve this?
from delta.
I was able to make the error go away by editing the tsconfig.json
in two different ways:
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
Add either of the above lines inside the "compilerOptions": { ... }
to fix ✅
from delta.
import diff from 'fast-diff';
->
import diff = require('fast-diff');
from delta.
@dgreensp What a nice answer, it solved the issue. Thanks :)
from delta.
@dgreensp This is not working for me. I turned on this option, this is my tsconfig.ts
file:
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"importHelpers": true,
"esModuleInterop": true,
"target": "es5",
"baseUrl": "./src",
"paths": {
"@angular/*": ["../node_modules/@angular/*"],
"app/*": ["app/*"],
"shared/*": ["app/shared/*"],
"shared": ["app/shared"],
"spec-helpers/*": ["app/spec-helpers/*"],
"spec-helpers": ["app/spec-helpers"],
"admin_app/*": ["app/admin_app/*"],
"admin_app": ["app/admin_app"],
"style_guides_app/*": ["app/style_guides_app/*"],
"style_guides_app": ["app/style_guides_app"]
},
"typeRoots": ["node_modules/@types"],
"types": ["node", "jasmine", "googlemaps"],
"lib": ["es2018", "dom"]
}
}
I still get the error:
node_modules/@types/quill/node_modules/quill-delta/dist/Delta.d.ts:1:8 - error TS1192: Module '"/home/admin/Documents/projects/project-angular/node_modules/@types/quill/node_modules/fast-diff/diff"' has no default export.
My Typescript version is ~3.2.2
from delta.
I'm having the same problem, and esModuleInterop didn't work. Had to remove @types/quill for now because it caused build to fail.
from delta.
Related Issues (20)
- Validity checking insert/delete/retain operations HOT 1
- Release the package as es6 module HOT 1
- Format of a multi-line block quote?
- How to find the effective length of a Delta
- Quill delta / Angular 13 / Webpack error HOT 3
- Supporting nested quotes and lists HOT 1
- Question: how to convert Delta to DeltaStatic? HOT 1
- Definition of "document" vs "non-document" delta HOT 1
- Any plans for the ES version? HOT 5
- Delta `alignment` attribute is ambiguous and doesn't have the right value HOT 1
- Word-level diff behavior HOT 3
- Get incorrect delta by Delta.transform HOT 1
- Generic `Delta<T>`? HOT 5
- Delta doesn't insert empty line
- Bug in production from using Esnext + vite HOT 2
- can't diff embed bolt
- RFC:Nested combinations
- Feature request: an operation to convert Delta format to html HOT 2
- Request support for ESM HOT 3
- I packed quill-delta with a webpack but can't use new Delta() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from delta.