DAILY DOCDAILY DOC
Rust
Node
Notes
Ubuntu
Leetcode
  • it-tools
  • excalidraw
  • linux-command
Rust
Node
Notes
Ubuntu
Leetcode
  • it-tools
  • excalidraw
  • linux-command
  • BFC 块级格式化上下文
  • Note
  • WebAssembly
  • public api
  • 位运算
  • bitwise operator
  • css实现隐藏效果
  • css snippets
  • 抖音点赞
  • js 相等判断
  • fetch ReadableStream
  • git
  • Github Actions 工作流
  • google search
  • RPC vs HTTP
  • gravatar
  • hhkb
  • Init project
  • input 文件上传
  • mac

    • Mac 使用技巧
    • alfred
    • mac shortcuts
    • shortcuts text edit
    • mac 修改host
  • 微前端
  • mock
  • nginx dump
  • nginx
  • NirCmd
  • npm
  • Operator Precedence
  • package.json
  • url query 解析
  • pnpm
  • JavaScript Precise countdown
  • react 模版
  • regexp
  • setup web development
  • telegram

    • telegram bot
  • timeFunction ease
  • 视频裁剪
  • vscode

    • vscode 高级指南
    • bracketPairs
    • jsconfig.json
    • vscode pipe into code
    • social project
    • vscode tasks
  • draggable resizable
  • windows 激活
  • 前端截图实现
  • 文本配音 富文本实现
  • 图片处理
  • 前端坐标
  • 定时任务
  • work efficient
  • 微信小程序动画实现方案
  • 排列组合
  • 数列
  • 语音驱动文字
  • 浏览器
  • 状态管理
  • 移动盒子
  • 移动端开发常用snippets
  • 设计模式
  • web performance

jsconfig.json

descendant of tsconfig.json width allowJs:true 项目根目录 添加该配置文件

Why do I need a jsconfig.json file

Benefits

  • Better IntelliSense
  • Explicit Project

Tip: To check if a JavaScript file is part of JavaScript project, just open the file in VS Code and run the JavaScript: Go to Project >Configuration command. This command opens the jsconfig.json that references the JavaScript file. A notification is shown if the file is > not part of any jsconfig.json project.

Using webpack aliases

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "ClientApp/*": ["./ClientApp/*"]
    }
  }
}

Global variables and type checking

Create a globals.d.ts

interface Window {
  webkitNotifications: any;
}
declare var CAN_NOTIFY: number;
jsconfig.json
{
  "compilerOptions": {
    "baseUrl": "./", // root directory
    "checkJs": true, // 开启js type 检查
    "paths": {
      // path alias
      "app": ["./app"]
    },
    "module": "commonjs",
    "target": "es2020",
    "jsx": "preserve",
    "strictFunctionTypes": true
  },
  // 配置 lib types 推导文件
  "typeAcquisition": {
    "include": ["jquery"]
  },
  // 项目文件
  "exclude": ["node_modules", "**/node_modules/*", "dist", "build", "tmp"]
}

Refer

  • vscode jsconfig.json
  • typescript
Last Updated:
Contributors: rosendo
Prev
bracketPairs
Next
vscode pipe into code