
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
typecheck-extended
Advanced tools
JavaScript type checker with extended types. Validates all built-in types. Additionally adds support for enums and makes an easier distinction between array and object.
npm i typecheck-extended
The following native JS types are supported as-is:
booleanfunctionnumberstringsymbolundefinedarray: Arrays only. (ex. ['a', 'b', 'c'])enum: Adds enum support.object: Non-array objects only. (ex. { a: 1, b: 2, c: 3 })In javascript, arrays have a typeof "object". typecheck-extended excludes arrays from an "object" type check.
/*
Standard Javascript
*/
>> typeof ['River Tam', 'Mal Reynolds']; // Returns "object"
>> typeof { name: 'Kaylee Frye' }; // Returns "object"
>> Array.isArray(['River Tam', 'Mal Reynolds']); // Returns true
>> Array.isArray({ name: 'Kaylee Frye' }); // Returns false
/*
typecheck-extended
*/
>> TypeCheck(['River Tam', 'Mal Reynolds'], 'array'); // Returns true
>> TypeCheck({ name: 'Kaylee Frye' }, 'array'); // Throws error
>> TypeCheck({ name: 'Kaylee Frye' }, 'object'); // Returns true
>> TypeCheck(['River Tam', 'Mal Reynolds'], 'object'); // Throws error
parameter: Any - The parameter to have its type validatedtype: String - Expected type of parameter. Limited to one of the Available Types listed above.required: Bool - Defaults to true. (Optional).format: Array - List of valid enums. (Optional).name must be received AND be string.
function SayHi(name) {
TypeCheck(name, 'string');
return (`Hi ${name}!`);
}
name can be undefined or null
If name is received, it must be string.
function SayHi2(name) {
TypeCheck(name, 'string', false);
if (name) {
return (`Hi ${name}!`);
}
return ("Hi, I'm typecheck-extended. What's your name?");
}
uuid must be received AND be string.
color must be received AND be red, green, or blue.
const availableColors = ['red', 'green', 'blue'];
function SaveColorValue(uuid, color) {
TypeCheck(uuid, 'string');
TypeCheck(color, 'enum', true, availableColors);
SaveToDb(uuid, color);
}
FAQs
Extended JavaScript Type Validator
The npm package typecheck-extended receives a total of 16 weekly downloads. As such, typecheck-extended popularity was classified as not popular.
We found that typecheck-extended demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.