添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
冷冷的汉堡包  ·  魔性社区软件 - 百度·  6 月前    · 
侠义非凡的大象  ·  摩天轮票务·  8 月前    · 
任性的弓箭  ·  while循环·  11 月前    · 
0
1

More than 1 year has passed since last update.

【TypeScript】parameter implicitly has an 'any' type

Posted at

エラー内容

JavaScriptコードをTypeScript化しようとしていた時、

function titleCheck(title){
        if(jsonData[title] != undefined){
            return jsonData[title];
        }else{
            message.channel.send("そのゲームは登録されていません");
            return null;

という関数がもともとあったんですが、
というエラー発生。

1. 引数の型を明記する

any型を持たないように、きちんと型を明記しておくというシンプルな解決法。

function titleCheck(title: string){
2. tsconfig.jsonを書き換える

80行目くらいにある

// "noImplicitAny": true,                            /* Enable error reporting for expressions and declarations with an implied 'any' type. */
"noImplicitAny": false

に書き換えるとエラー消えました。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1