Git Product home page Git Product logo

Comments (1)

samchon avatar samchon commented on May 24, 2024 1

I've fixed the error by shifting the Readonly type wrapper from Driver.Promisive to Driver. Therefore, the error has been fixed. From the [email protected] update, there would not be any error in the [email protected] environment.

By the way, there's not any difference between below two codes, but TypeScript v3.9.2 compiler draws different results. I need to study the detailed reason and write an issue to the TypeScript, with much easier sample code than below:

Before Patch - Be Compile Error

The Readonly type is wrapping the Driver.Promisive type from the inside.

export type Driver<Controller extends object, Parametric extends boolean = false> 
    = Driver.Promisive<Controller, Parametric>;

export namespace Driver
{
    export type Promisive<Instance extends object, UseParametric extends boolean = false> = Readonly<
    {
        [P in keyof Instance]: Instance[P] extends Function
            ? Functional<Instance[P], UseParametric> // function, its return type would be capsuled in the Promise
            : value_of<Instance[P]> extends object
                ? Instance[P] extends object
                   ? Promisive<Instance[P], UseParametric> // object would be promisified
                   : never // cannot be
                : never // atomic value
    } & IRemoteObject>;
}

After Patch - No Error

The Readonly type is wrapping Driver.Promisive type from the outside by the Driver type.

export type Driver<Controller extends object, Parametric extends boolean = false> 
    = Readonly<Driver.Promisive<Controller, Parametric>>;

export namespace Driver
{
    export type Promisive<Instance extends object, UseParametric extends boolean = false> = 
    {
        [P in keyof Instance]: Instance[P] extends Function
            ? Functional<Instance[P], UseParametric> // function, its return type would be capsuled in the Promise
            : value_of<Instance[P]> extends object
                ? Instance[P] extends object
                   ? Promisive<Instance[P], UseParametric> // object would be promisified
                   : never // cannot be
                : never // atomic value
    };
}

from tgrid.

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.