Skip to content

Commit

Permalink
Cast style-spec types to Type
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Wipfli authored and wipfli committed Jul 18, 2021
1 parent f0a3c36 commit 4af74a6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/style-spec/expression/values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,21 @@ export function isValue(mixed: unknown): boolean {

export function typeOf(value: Value): Type {
if (value === null) {
return NullType;
return NullType as Type;
} else if (typeof value === 'string') {
return StringType;
return StringType as Type;
} else if (typeof value === 'boolean') {
return BooleanType;
return BooleanType as Type;
} else if (typeof value === 'number') {
return NumberType;
return NumberType as Type;
} else if (value instanceof Color) {
return ColorType;
return ColorType as Type;
} else if (value instanceof Collator) {
return CollatorType;
return CollatorType as Type;
} else if (value instanceof Formatted) {
return FormattedType;
return FormattedType as Type;
} else if (value instanceof ResolvedImage) {
return ResolvedImageType;
return ResolvedImageType as Type;
} else if (Array.isArray(value)) {
const length = value.length;
let itemType: Type | typeof undefined;
Expand All @@ -103,7 +103,7 @@ export function typeOf(value: Value): Type {
return array(itemType || ValueType, length);
} else {
assert(typeof value === 'object');
return ObjectType;
return ObjectType as Type;
}
}

Expand Down

0 comments on commit 4af74a6

Please sign in to comment.