Skip to content

feature: Define Schema, TSInterface, JSRunTime information, Validator without decorators, only TS, possibly class too. #734

Open
@wesleyolis

Description

@wesleyolis

Description

The ability to defined typescript interface and the runtime JS validation information with out using decorators or any pre process only using the capabilities of typescript.

Proposed solution

I look at hacking typescript about 3 years back on to see what we where able to do, to be able to define typescript information for interfaces and runtime JS code for validation at the same time. So we looked at how we could define implicitly typescript information for while writing run time code. We managed to get something working and I would like to share it with you, because the pattern that we managed to find out, allowed us to do this successfully. We based our validation of of using joi as a base, sadly at the time it doesn't run the the browser. Maybe the same pattern could be adjusted and used by yourselves in future in different aspects of things.

ConfigFactoryLoder And Validator, using special runtime TS definitions to extract type script interfaces
Just do a bit of browsing around here. chosen hack was that work in ts 2.4 and later versions, with no issues, compared to other methods and hacks.

Another Project was also the ability to support generation of final populate and deepPopulate commands support for Mongoose/Mongo... or anything else requiring relationship.
https://github.com/wesleyolis/mongooseRelationalTypes

Metadata

Metadata

Assignees

No one assigned

    Labels

    flag: needs discussionIssues which needs discussion before implementation.type: featureIssues related to new features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions