Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/esm/json/index.js>type

A JavaScript extension package for building strong and modern applications.
Latest
function type
import { type } from "https://deno.land/x/ayonli_jsext@v0.9.72/esm/json/index.js";

A decorator to instruct that the target property in the class is of a specific type.

When parsing JSON via parseAs, this property is guaranteed to be of the given type.

NOTE: This decorator only supports TypeScript's experimentalDecorators.

Examples

Example 1

import { type } from "@ayonli/jsext/json";

class Example {
    \@type(Date)
    date: Date;
}