🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more
Socket
Book a DemoInstallSign in
Socket

@lazycatcloud/wujie-typings

Package Overview
Dependencies
Maintainers
12
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lazycatcloud/wujie-typings

Wujie 类型定义

latest
npmnpm
Version
1.0.7
Version published
Maintainers
12
Created
Source

无界类型定义

fork by https://gitee.com/jh_shot/wujie-typings

基于 Wujie 1.0.6 版本编写

  • Vue组件
    • vue <= 2.6 引用 v26.d.ts
    • vue 2.7 引用 v27.d.ts
    • vue >= 3 引用 v3.d.ts
  • JSX组件引用 jsx.d.ts
  • 全局变量引用 global.d.ts

tsconfig.json 示例:

{
  "compilerOptions": {
    "types": [
      "@lazycatcloud/wujie-typings/global",
      "@lazycatcloud/wujie-typings/jsx"
    ]
  }
}

自定义 bus 类型

tsconfig.json 中添加 bus_overwrite

{
  "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
  "compilerOptions": {
    "types": [
      "vite-plugin-svg-icons/client",
      // ==================添加这两行
      "@lazycatcloud/wujie-typings/global",
      "@lazycatcloud/wujie-typings/bus_overwrite",
      // ==================
    ]
  },
}

然后自己覆盖掉 window.$wujie.bus

import { EventBus } from '@lazycatcloud/wujie-typings/bus_overwrite'

// 参考: https://github.com/developit/mitt
type RealBus = {
  'header:show'?: boolean
  'header:hide'?: boolean
}

declare global {
  interface Window {
    $wujie: {
      bus: EventBus<RealBus>
    }
  }
}

export {}

Keywords

Wujie

FAQs

Package last updated on 24 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts