TypeTags .EvalError

Overview

The EvalError object indicates an error regarding the global eval() function. This exception is not thrown by JavaScript anymore, however the EvalError object remains for compatibility.

Usage

import { TypeTags } from 'typetags'
try {
throw new EvalError('Hello', 'someFile.js', 10)
} catch (e) {
console.log(TypeTags.get(e))
// → [object Error]
}
console.log(TypeTags.EvalError)
// → [object Error]

Predicate

TypeTags.isEvalError(value)

️🚫

Since error objects do not have unique type tags, a EvalError type tag is the same as any other Error object. If you need to check if an error is an instance of a EvalError, use instanceof instead.

  • Checks if value is or has a default EvalError type tag.
const { TypeTags } = require('typetags')
let err = new EvalError()
TypeTags.isEvalError(err)
// → true
TypeTags.isEvalError(new TypeError())
// → true
TypeTags.isEvalError(err.toString())
// → false

Metadata (TType)

MetadataValue
.typeEvalError
.tag[object Error]
.builtin()undefined
.getTag()[object Error]
.hasSpecialArgs()false
.instance()undefined
.instanceTypeOf()object
.info()see more
.isAvailable()true
.isConstructor()true
.isFactory()true
.isFunction()true
.isGlobal()true
.isIterator()false
.isNested()false
.isObject()false
.isPrimitive()false
.isStringifiable()true
.isSyntatic()false
.isTypedArray()false
.ownKeys()[length, name, prototype]
.toString()function toString() { [native code] }
.typeOf()function

Signature

declare type ITypeTags = {
[key in Types | NestedTypes]: Tags
}
declare interface Predicate {
predicate(value: any): boolean
}

See MDN Web Docs