Comments (9)
@ph3b Thank you for your report.
This is certainly not a good result for the TypeScript specification.
However, I do not currently have a good idea of what to do.
What do you think would be the best outcome in this case?
from dtsgenerator.
Hi, I'm using this from a c# side. I'm going to hack my instance to the following
[name: string]: any;
My generated snippet is
export interface ProblemDetails {
[name: string]: null;
type?: string | null;
title?: string | null;
status?: null | number; // int32
detail?: string | null;
instance?: string | null;
extensions?: {
[name: string]: any;
} | null;
}
the doc is
"ProblemDetails": {
"type": "object",
"additionalProperties": {
"nullable": true
},
"properties": {
"type": {
"type": "string",
"nullable": true
},
"title": {
"type": "string",
"nullable": true
},
"status": {
"type": "integer",
"format": "int32",
"nullable": true
},
"detail": {
"type": "string",
"nullable": true
},
"instance": {
"type": "string",
"nullable": true
},
"extensions": {
"type": "object",
"nullable": true,
"additionalProperties": {}
}
}
},
from dtsgenerator.
@horiuchi
looks like there is no solution, only add unknown
or any
type to repair compilation:
export interface MicrosoftAspNetCoreMvcProblemDetails {
[name: string]: {
[key: string]: any;
} | unknown;
...
from dtsgenerator.
@npdev453
It is true that there seems to be no solution for the current TypeScript type system,
but adding unknown
or any
would overwrite the type, making the typeset practically meaningless.
from dtsgenerator.
Related Issues (20)
- choice between interface or class HOT 3
- get draft error in `http://json-schema.org/schema` HOT 2
- File 'types.d.ts' is not a module. HOT 1
- PathParameters are not generated properly when parameter is declared in the component HOT 5
- Support OpenAPI 3.1
- Support `JSON Schema 2020-12` HOT 1
- Use of "oneOf" is not working properly HOT 2
- null choices in nullable enums is cast in string HOT 2
- When definitions are not defined, we hope to be compatible without affecting the export of d.ts file HOT 1
- --useUnionTypes doesn't work on $ref
- Type generation malforming objects with number-like keys HOT 5
- Move this project and generate result to ESM HOT 2
- Common Parameters for Various Paths Different API paths not resolved correctly HOT 7
- complex nullable type, change in behavior HOT 4
- [Question] Is it possible to export the namespace? HOT 1
- If there are 8s and 9s, they will be zero-suppressed. HOT 3
- Nesting multiple, separate objects defined with oneOf in allOf does not work as expected HOT 2
- jsdoc comments are placed after property name
- How do I suppress long prefices? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dtsgenerator.