Skip to content

Unable to do module augmentation for class constructor #19372

@Alphapage

Description

@Alphapage

TypeScript Version: 2.5.3

Code

// mod.d.ts
declare module 'm' {
  export class C {
    constructor(s:string,n:number)
    test(s: string): void
  }
  export function func(): void
}

// m.ts
///<reference path='./mod.d.ts'/>
import * as m from 'm'

declare module 'm' {
    interface C {
      new(d:Date): C
      constructor(d:Date): C
      (d:Date): C
      test2(): void;
      test(s:any)
    }
  }

new m.C(   // only (s:string,n:number) , no (d:Date) as expected

Expected behavior:
m.C constructor should display (s:string,n:number) and (d:Date) in intellisense
Actual behavior:
m.C constructor only displays (s:string,n:number)

You learn me how to augment a class from a module, but I'm unable to augment the class constructor.
Thank you in advance for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions