meta.type-of($value) returns an unquoted string naming the Sass type of $value—for example number, string, list, or map. Load with @use "sass:meta".
Official samples.
meta.type-of(10px) → number · meta.type-of(10px 20px 30px) → list · meta.type-of(()) → list.
Compare unquoted names.
Write @if meta.type-of($v) == number. A quoted "number" is a different string value.
New types may appear.
Official docs: more return values may be added later. Fail safely for unknown types.
Syntax
Syntax
SCSS
@use "sass:meta";
meta.type-of($value); //=> unquoted string
meta.type-of(10px); // number
meta.type-of(10px 20px 30px); // list
meta.type-of(()); // list
@if meta.type-of($v) == number {
// …
}
// Global alias (legacy): type-of($value)
// Prefer meta.type-of after @use "sass:meta"
Pattern: pass any value → get a type name → branch with @if against unquoted names.
Reference
Possible Return Values
Official docs currently list these type names:
Return
Example value
Notes
number
10px, 0.5
Simplified calc() may become this
string
"hello", serif
Quoted or unquoted
color
#c69, red
—
list
10px 20px, bare ()
Empty () is usually list
map
("a": 1)
Map-made empty may also be map
calculation
calc(1px + 100%)
Unresolved CSS math
bool / null
true / null
—
function / mixin / module / arglist
Advanced values
From meta helpers / $args...
vs meta.inspect.
meta.inspect shows what a value looks like. type-of answers what kind it is.
Compare without quotes: == number, not == "number".
Great for flexible APIs that branch on input shape.
Use inspect for snapshots; use type-of for kinds.
One line: to ask what kind of Sass value you have, use meta.type-of($value).
Practice
Compile Notes
Practical checklist:
checklist.txt
1. @use "sass:meta"
2. $t: meta.type-of($value)
3. @if $t == number { … } // unquoted
4. Guard math / color helpers by type
5. Keep an @else for unknown future types
Frequently Asked Questions
meta.type-of($value) returns an unquoted string that names the Sass type of $value—for example number, string, color, list, or map.
Compare against unquoted type names: @if meta.type-of($v) == number { … }. Quoted "number" is a different string value.
Official docs: empty () may be list or map depending on whether a map function produced it. A bare () is typically list.
Unresolved calculations return calculation. Some calcs simplify to a number at compile time—those return number instead.
Yes. type-of($value) is the legacy global name. Prefer meta.type-of after @use "sass:meta".
Yes. Official docs say new possible values may be added in the future—write @if branches that fail safely for unknown types.