Typescript type "Date" is misrecognized as user-defined type
- Dominant language
- TypeScript
- Stars
- 447
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
I have a script running from CLI which transforms typescript definitions to openapi. When having a model like this
```ts
export interface MyObject {
startDate: Date,
otherProp: string
}
```
the output is this
```json
{
"MyObject": {
"type": "object",
"properties": {
"startDate": {
"$ref": "#/definitions/Date",
"title": "myObject.startDate"
},
"otherProp": {
"type": "string",
"title": "myObject.otherProp"
}
},
"required": [
"startDate",
"otherProp"
],
"additionalProperties": false,
"title": "MyObject"
}
}
```
The Date type is being interpreted as a user defined type, but it is not. It's a native type
Expected output is
```json
{
"MyObject": {
"type": "object",
"properties": {
"startDate": {
"type": "string",
"format": "date-time",
"title": "myObject.startDate"
},
"otherProp": {
"type": "string",
"title": "myObject.otherProp"
}
},
"required": [
"startDate",
"otherProp"
],
"additionalProperties": false,
"title": "MyObject"
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.