dsherret / ts-type-info

TypeScript AST and code generator [Deprecated]
MIT License
94 stars 8 forks source link

Method and function signatures in ambient context - Generated implementation signature #218

Closed dsherret closed 7 years ago

dsherret commented 7 years ago

For example:

class TypeParameterDefinition {
    setConstraintType(definition: NamedDefinition, typeArguments?: undefined | string[]): this;
    setConstraintType(text: string): this;
}

Should have two overload signatures and one implementation signature. Right now it uses the last signature for the implementation signature.


The implementation signature should be (this is kind of a compromise to make this scenario work within the library):

class TypeParameterDefinition {
    setConstraintType(definition: NamedDefinition, typeArguments?: undefined | string[]): this;
    setConstraintType(text: string): this;
    setConstraintType(param1: NamedDefinition | string, param2?: undefined | string[]): this {
    }
}

So basically a signature that is a combination of all the types. I'm thinking the name of the parameters should be numbered like what is shown above to not create too much complexity. I could probably add a unionize method to TypeDefinition that handles creating the union types.