Skip to content

Types are missing the ctx.request.params property #26

@opl-

Description

@opl-

Current behavior

Using the following code in TypeScript results in an error:

import {Cottage} from 'cottage';
const router = new Cottage();
router.get('/:id', (ctx) => {
    return `Requested id: ${ctx.request.params.id}`; // Property 'params' does not exist on type 'Request'. ts(2339)
});

Expected behavior

The types correctly recognize the Request.params property.

Environment

Cottage v3.1.3 (npm latest)
TypeScript v3.9.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions