question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generating data type based on custom type's base type?

See original GitHub issue

We 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:open
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mrjono1commented, May 13, 2022

As a very simple workaround yes it would

1reaction
malhotraamit236commented, May 13, 2022

@mrjono1 wouldn’t meta be able to solve this?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found