Giter Club home page Giter Club logo

js-dts's Introduction

js-dts's People

Contributors

jesonhu avatar

Stargazers

归谜 avatar

Watchers

 avatar

js-dts's Issues

01. 定义一个必须包含某项,但可以包含其他属性的接口

定义一个必须包含某项,但可以包含其他属性的接口

创建时间 更新时间 来源
2019/01/30 2019/01/30 原创

方式1: interface 实现

interface A { 
    a: string
    b: string
    c: string
    [key: string]: any
}

// good
const a: A = { 
    a: '1',
    b: '2',
    c: '3',
    e: 1
}

// bad
const b: A = {
    e: 1
}

方式2: type 实现

type A = {
    a: string,
    b: string,
    c: string
} & Record<string, any>

// good
const a: A = {
    a: '1',
    b: '2',
    c: '3',
    d: 13131
}

// bad
const b: A = {
    c: '3'
}

02. Vue with TS

Vue with TS

更新时间 创建时间 来源
2019/01/30 2019/01/30 原创

以下内容是在 Vue 2.x 环境下整理的.

Vue 单页面全局变量类型如何声明

Vue.prototype.$http = xxx;

当在组件中使用 this.$http 发现会报错。解决方案如下:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.