Giter VIP home page Giter VIP logo

Comments (9)

horiuchi avatar horiuchi commented on July 17, 2024

@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.

panzors avatar panzors commented on July 17, 2024

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.

npdev453 avatar npdev453 commented on July 17, 2024

@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.

horiuchi avatar horiuchi commented on July 17, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.