ByteNote LogoByteNote

Navigation

  • Blog
  • 工具

    © 2025 ByteNote. All rights reserved.

    TS 类型声明文件的一般写法

    Feb 25, 202311 min read

    TS 类型声明文件通常以 .d.ts 后缀结尾,用于描述 JavaScript 库或模块的类型信息

    // math.d.ts
    
    declare module 'math' {
      export function add(a: number, b: number): number;
      export function subtract(a: number, b: number): number;
    }
    

    使用

    // app.ts
    
    import { add, subtract } from 'math';
    
    const result1: number = add(1, 2);
    const result2: number = subtract(4, 2);
    

    相关文章

    Flutter GetX的生命周期

    Flutter GetX框架中CounterController类的生命周期包括初始化、加载完成和控制器释放三个阶段。

    Deep Dive into Vue 3 v-model and Dialog Component Encapsulation

    Vue 3's v-model simplifies two-way data binding with syntactic sugar, customizable names, and multiple bindings, enabling robust and reusable component development, especially for dialogs, when combined with TypeScript and best practices.

    Flutter 修改应用名称

    在Flutter应用中,修改Android应用名需编辑AndroidManifest.xml中的label属性,iOS应用名在Info.plist中设置CFBundleDisplayName,而Mac iOS应用名则直接在Xcode的Runner面板中修改DisplayName。

    React route routes属性

    子路由可以作为单独的`routes`属性传递给`Router`组件,而不必嵌套在`Router`组件内部。

    GO for range循环遍历数组

    介绍了使用`for`循环和`for range`循环两种方式遍历数组的方法。