TypeScript ctx has 'any' type
Extarys opened this issue · 2 comments
Extarys commented
Is anyone smart enough to fix typings-koa-views ?
[nodemon] starting `./node_modules/.bin/ts-node ./index.ts`
/media/jer/DarkHawk/srv/http/RemoteVLUS/www/GameMaster/node_modules/ts-node/src/index.ts:296
throw new TSError(formatDiagnostics(diagnosticList, cwd, ts, lineOffset))
^
TSError: ⨯ Unable to compile TypeScript
index.ts (29,26): Parameter 'ctx' implicitly has an 'any' type. (7006)
Code:
app.use(async function (ctx) {
await ctx.render('index')
})
I have no idea how to fix that... :\
edit
Ok my mistake - new to TypeScript.
app.use(async function (ctx:any) {
await ctx.render('index')
})
This is working - is 'any' any good :P
int64ago commented
It seems you've solved the problem, closed.
maicss commented
It should be ctx: Koa.Context, next: Function
, see https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/koa/index.d.ts#L12