Generating data type based on custom type's base type?
See original GitHub issueWe have some custom types we’re using (Mainly to control the value format in a consolidated place)
An example:
export const Joi = Joi.extend(joi => {
return {
type: 'time',
base: joi.string().pattern(/^\d{2}:\d{2}:\d{2}-\d{4}$/),
};
})
const UserSchema = Joi.object({
name: Joi.string().required(),
timeSubmitted: Joi.time().required()
})
But it’s getting generated as this:
interface UserSchema {
name: string;
time: unknown;
}
Is there a way to generate time
as a string since that’s its base type?
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How To Create Custom Types in TypeScript - DigitalOcean
Though the pre-made, basic types in TypeScript will cover many use cases, creating your own custom types based on these basic types will...
Read more >Creating Custom Data Types
The User Defined Type feature allows these custom data types to be plugged in to the data translation run-time engine.
Read more >Is there a way in Java to build custom types based on java ...
Usual way to deal with it is to create wrapper class. For example: public class LastName { private final String value; public LastName ......
Read more >Documentation: 15: CREATE TYPE - PostgreSQL
The first form of CREATE TYPE creates a composite type. The composite type is specified by a list of attribute names and data...
Read more >Create a User-Defined Data Type Alias - SQL Server
Learn how to create a user-defined data type alias in SQL Server 2019 by using SQL Server Management Studio or Transact-SQL.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As a very simple workaround yes it would
@mrjono1 wouldn’t
meta
be able to solve this?