Is `DeclarationRaws#value` property optional?
See original GitHub issueSummary
The DeclarationRaws#value
property is required on the current PostCSS type definitions:
But actually, the property can be optional.
const src = "a { background: linear-gradient(to right, #fff, #ddd) }";
postcss.parse(src).walkDecls((decl) => {
console.log(decl.raws.value.raw);
// ↑ undefined
});
See the following reproduction for details.
Reproduction
Type-checking passes, but running the code raises an error:
https://gist.github.com/ybiquitous/eabe11abd1ecb1feae79614ed12502bb
Environment
PostCSS 8.4.8
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Optional property class in typescript - Stack Overflow
Optional property: In Typescript you can declare a property in your interface which will be optional. Suppose you have a interface for ...
Read more >How to Make Certain Properties Optional in TypeScript
The declaration of the interface is a place to make some properties optional. You can achieve that with a question mark next to...
Read more >How to Deal with Optional Things and "Undefined" in TypeScript
An uninitialized or absent property of an object; A potentially-omitted optional argument to a function; A return value to indicate something ...
Read more >Wrong Type Error on missing property when using optional ...
missing property. Expected behavior: Typescript should handle the optional method as same as optional properties. Actual behavior: Typescript ...
Read more >TypeScript - Interfaces with Optional Properties - LogicBig
In TypeScript, the interfaces which describe objects can have optional properties. Interfaces with optional properties are written similar ...
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 Free
Top 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
Released in 8.4.11.
@ai Thank you for the quick fix! 😄