1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

claspの開発でGASの補完が効かなくなった話

Posted at

きっかけ

claspを使ってVSCodeでGASの開発を行っていましたが、気づくと補完が効かなくなっていることに気づきました。さすがに不便だったので解決しようといろいろなところを調べたので、載せます。ご参考までに。

解決方法

claspのコマンドでいつも通りローカルにプロジェクトをクローンした後、以下のことを行いました。

型定義ファイルのインストール

プロジェクトのあるフォルダまで移動し、次のコマンドを実行。

npm init --y
npm install @types/google-apps-script --save-dev

これでフォルダの中に型定義のファイルがインストールできました。

つなげる

なぜかこれだけだと認識しなかったので、同じフォルダの中に「jsconfig.json」を作成し、中身を以下のようにした。

{jsconfig.json}
{
    "compilerOptions": {
      "target": "ES6"
    }
}

これで、さっきインストールした型定義ファイルたちを読み込み、補完が効き始めると思います。

参考にしたサイト

以下のwebサイトを参考にさせていただきました。

1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?