DEV Community

Discussion on: Write a small API using Deno

Collapse
 
dharmaram profile image
dharmaram

TS7031 [ERROR]: Binding element 'response' implicitly has an 'any' type.
export default async ({ params, request, response }) => {
~~~~~~~~
at file:///C:/Users/DHARM/deno-js/deno-practice/handlers/updateUser.ts:3:42

Collapse
 
anditsou profile image
Ítalo Sousa

I had the same issue. It's an issue that happens after newer updates at Deno's TS compiler. You should explicitly type those variables. I did this way and it worked for me:

import { Response } from 'https://deno.land/x/oak/mod.ts';

const hello = ({ response }: { response: Response}) => {
    response.body = { message: 'Hello World' };
};

export default {
    hello
}