Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing styles gives an error "An expression of type 'void' cannot be tested for truthiness." #4074

Closed
vinodgubbala opened this issue Mar 22, 2024 · 2 comments · Fixed by #4076

Comments

@vinodgubbala
Copy link

I see quill has moved from package based import to module based import.
I mean earlier everything used to be imported from dist folder. But with version 2, we can import module from individual file.
This helped with types.

But I guess we should still import css from dist folder.
But I see a weird file .css.js along with .css files.
Can I know what these files are.

node_modules/quill/dist/quill.core.css.js:2:2 - error TS1345: An expression of type 'void' cannot be tested for truthiness.

2 !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Quill=t():e.Quill=t()}(self,(function(){return function(){"use strict";var e={};return e.default}()}));
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/quill/dist/quill.core.css.js:2:104 - error TS2304: Cannot find name 'define'.

2 !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Quill=t():e.Quill=t()}(self,(function(){return function(){"use strict";var e={};return e.default}()}));
                                                                                                         ~~~~~~

node_modules/quill/dist/quill.core.css.js:2:112 - error TS2304: Cannot find name 'define'.

2 !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Quill=t():e.Quill=t()}(self,(function(){return function(){"use strict";var e={};return e.default}()}));
                                                                                                                 ~~~~~~

node_modules/quill/dist/quill.core.css.js:2:123 - error TS2304: Cannot find name 'define'.

2 !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Quill=t():e.Quill=t()}(self,(function(){return function(){"use strict";var e={};return e.default}()}));
                                                                                                                            ~~~~~~

node_modules/quill/dist/quill.core.css.js:2:181 - error TS2339: Property 'Quill' does not exist on type 'Window & typeof globalThis'.

2 !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Quill=t():e.Quill=t()}(self,(function(){return function(){"use strict";var e={};return e.default}()}));
     

Steps for Reproduction

  1. Create react project
  2. Add Editor with quill
  3. Import styles using import 'quill/dist/quill.core.css'; and import 'quill/dist/quill.snow.css';
  4. Compile types using tsc -p src/jsconfig.json --noEmit

Expected behavior:
No errors

Actual behavior:
Errors from *.css.js"

Platforms:
React

Version:
2.0.0-rc.3

@vinodgubbala vinodgubbala changed the title Importing styles gives and error "An expression of type 'void' cannot be tested for truthiness." Importing styles gives an error "An expression of type 'void' cannot be tested for truthiness." Mar 22, 2024
@luin
Copy link
Member

luin commented Mar 22, 2024

Those .css.js are generated by webpack which should be ignored actually. In the next version we are going to remove it. When importing styles, you would import the .css files.

@vinodgubbala
Copy link
Author

Thanks @luin . Waiting for the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants