Comments (5)
Hi @MurhafSousli, I experienced same issue as @konradkurylo with "strictTemplates": true
option in angularCompilerOptions, tsconfig.json.
I don't think there is a need to for a new pipe, but the highlight
directive should already handle if the value is null
, which is possible return value from async pipe.
In the ngOnChanges
of highlight.ts, there is already check for currentValue !== null
.
I believe @Input('highlight') code!: string;
could be changed to @Input('highlight') code!: string | null;
and that should fix the error and hopefully don't break anything.
I like you package and I'm happy to open PR, if you would agree with the change.
from ngx-highlightjs.
@jasomimo In this case, you need to remove the bang from the variable because it means the variable will not be null, as explained here
Try to verify if this fixes the issue or if other variables need to be updated the same way!
Thanks a lot!
from ngx-highlightjs.
Sorry for the late, v6.1.3 has been published! please let me know if the issue is fixed!
from ngx-highlightjs.
Please add reproduction here https://stackblitz.com/edit/ngx-highlightjs! You seem to have strict type template on your end.. I don't think there is a need for another pipe
from ngx-highlightjs.
@MurhafSousli I've updated highlight.ts
to accept also null
as valid value. I saw there is already a test for null
value, so I didn't add a new one. Change is available for a review in PR: #225
I tested ngx-highlightjs with this change in my project, where I was previously getting error and the fix worked well.
Looking forward to the feedback, if this works for you.
from ngx-highlightjs.
Related Issues (20)
- Highlight.js library was not imported and cannot read property 'themePath' of undefined HOT 16
- ERROR TypeError: Cannot read properties of null (reading 'themePath')
- Support loading of relative URLs HOT 2
- Usage in Angular module: Error: inject() must be called from an injection context HOT 1
- npm cannot resolve peer dependency @angular/common@">=14.0.0" from [email protected] HOT 1
- Could not find a declaration file for module 'highlightjs-line-numbers.js' - Show line numbers HOT 6
- The gist class member of the GistDirective is private
- Angular Universal - ERROR ReferenceError: requestAnimationFrame is not defined HOT 10
- Binding data from innerHtml HOT 5
- setTheme does not load theme if `themePath` was not specified in the configuration HOT 1
- line-number and styling not being applied for json HOT 3
- Angular 16
- Using ngx-highlightjs in stand-alone components
- Your documentation is probably outdated HOT 1
- (love) Just to tell you how great your software is HOT 2
- This repo not support pnpm HOT 9
- Add line numbers options HOT 1
- Multiline strings on C# breaks highlighting HOT 3
- Property '"code"' is incompatible with index signature. 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 ngx-highlightjs.