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

x/ayonli_jsext/json/index.ts>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/json/index.ts";

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;
}

Returns

PropertyDecorator