On this video Typescript is used for code completion. I followed the instructions from here and have Typescript working with the Hello World example. I have no idea what to do next to have code completion for Firebase.
How can I get code completion for Firebase in VS Code?
Update 1:
I created my Firebase project with the following commands in the VS code terminal: firebase init
, firebase init functions
. So I would also want the code completion to work in the functions/index.ts file that I will have to create, just saying.
Then I did npm init
and as sugested:
npm install --save-dev @types/firebase
In the root directory of the project now I have the node_module
directory with only @types/firebase
as content and this package.json file:
{
"name": "My Project",
"version": "1.0.0",
"description": "Does something",
"main": "index.js",
"dependencies": {},
"devDependencies": {
"@types/firebase": "^2.4.31"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Somebody",
"license": "ISC"
}
I also created a index.ts
file to test but when I type firebase.
no code completion. What is the next step to get the code completion?
Update 2:
.vscode/tasks.json:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"args": ["-w", "-p", "."],
"showOutput": "silent",
"isBackground": true,
"problemMatcher": "$tsc-watch"
}
tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"sourceMap": true
}
}
Still no code completion!
Update 3:
The beginning of the functions/index.ts
file where I am interested to see the code completion:
import * as firebase from 'firebase';
var functions = require('firebase-functions');
The import * as firebase from 'firebase'
part is from this video where I saw the code completion working. I would also want the code completion to work in public/app.ts
the client side file.
I use at the beginning of the functions/index.ts
import functions = require('firebase-functions');
import admin = require('firebase-admin');
and it works.
please install firebase typings to get firebase code completion
npm install --save-dev @types/firebase
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With