Allow guards to work with undefined variables
See original GitHub issue.guard () when (@variable) {
a {
color: red;
}
}
Variable isn’t defined, therefore no output.
@variable: true;
.guard () when (@variable) {
a {
color: red;
}
}
Variable is definied, therefore output:
a {
color: red;
}
Issue Analytics
- State:
- Created 10 years ago
- Comments:46 (24 by maintainers)
Top Results From Across the Web
How do you implement a guard clause in JavaScript?
jQuery ensures that undefined really is undefined and not some variable by doing this: function(undefined) { ... })() . Inside that closure, ...
Read more >How to check for undefined variables | Cruftless Craft
It reads as null which means you can guard against undefined errors like this: {# Check a variable with an empty default filter...
Read more >How To Do Anything in TypeScript With Type Guards
Type guards allow for run-time type checking by using expressions to see if ... type guard to remove undefined from the type of...
Read more >How to use type guards in TypeScript - LogRocket Blog
A type guard is a TypeScript technique used to get information about the type of a variable, usually within a conditional block.
Read more >5 Methods to use Type Guards in TypeScript - Bits and Pieces
With the help of typeof keyword, TypeScript can identify the variables declared separately supporting the Types given below. String; Boolean; Number; Undefined ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Has there been any movement on this request? I’ve been anxious for an undefined variable check for some time now. At the moment, I have a work around that is far from ideal…
but, for this to work, the variable must exist and be defined as
null
by default. This would be far more effective/flexible if I could just instead check if the variable even exists in the first place.What’s also happened since this was open is the
if()
function. So you can docolor: if((@variable), green, red);