Skip to content

implement inherited abstract method does not know the parameter types #17846

Closed
@TheColorRed

Description

@TheColorRed

TypeScript Version: 2.4.2

Code

Middleware.ts

import { Request, Response, NextFunction } from 'express'

export abstract class Middleware {
  public abstract handle(req: Request, res: Response, next: NextFunction);
}

Auth.ts

import { Middleware } from '.'

export class Auth extends Middleware {
  public handle(req, res, next) {

  }
}

Within the Auth class which extends Middleware the handle method has three parameters which are define in Middleware. In my vscode editor, within the Auth class those types are all any. I was expecting that those types would be read from the parent from which they were defined. However, they do not do this.

Since Auth knows if an abstract method has or has not been defined, shouldn't it also know the parameter types of the abstract method?

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions