Coder Social home page Coder Social logo

alleria's People

Contributors

jetsly avatar

Watchers

 avatar

alleria's Issues

dts

基础写法

interface IPerson {
  name: string;
  age: number;
}
type Person = {
  name: string;
  age: number;
};

继承

type PartPerson = {
  age: number;
};
interface IPartPerson {
  age: number;
}
type Person = {
  name: string;
} & PartPerson;
interface IPerson extends IPartPerson {
  name: string;
}

联合类型

type PartPerson = {
  name: number;
};
interface IPartPerson {
  name: string;
}
type Person = IPartPerson | PartPerson;

属性名字约束

type Person = {
  [k in 'age'|'name']: any;
};

只读属性

type Person = Readonly<{
  age: number;
  name: string;
}>;
interface _IPerson {
  age: number;
  name: string;
}
interface IPerson extends Readonly<_IPerson> {}

可选属性

type Person = Partial<{
  age: number;
  name: string;
}>;
interface _IPerson {
  age: number;
  name: string;
}
interface IPerson extends Partial<_IPerson> {}

非空属性

type Person = Required<{
  age?: number;
  name?: string;
}>;
interface _IPerson {
  age: number;
  name: string;
}
interface IPerson extends Required<_IPerson> {}

推导类型,用于继承

type TArray = Array<string | number>;
type ElementOf<T> = T extends Array<infer E> ? E : never;

ElementOf<TArray> === string | number

获取属性名

type Person = keyof {
  age: number;
  name: string;
};
interface _IPerson {
  age: number;
  name: string;
}
type IPerson = keyof _IPerson;

选取属性

type Person = Pick<{
  age: number;
  name: string;
},'name'>;
interface _IPerson {
  age: number;
  name: string;
}
interface IPerson extends  Pick<_IPerson,'name'> {}

排除属性

type Person = Omit<{
  age: number;
  name: string;
},'age'>;
interface _IPerson {
  age: number;
  name: string;
}
interface IPerson extends Omit<_IPerson,'age'> {}

实例类型

class _Person {
  name: string;
  age: number;
}
type Person =InstanceType<typeof _Person>

构造函数参数类型

class _Person {
  constructor(person:{name: string, age: number}) {}
}
type Person = ConstructorParameters<typeof _Person>;

返回类型

function _Person():{ name:string, age:number }{
  return  ....
}
type Person =ReturnType<typeof _Person>

参数类型

function _Person(person:{name: string, age: number}) {
  return ..
}
type Person = Parameters<typeof _Person>;

jenkins pipeline

加载groovy文件

configFileProvider([configFile(fileId: 'fileName', variable: 'filePath')]){
     script {
           def cfg = load(filePath)
      }
}

jumpserver

#!/usr/bin/expect
set timeout 30
spawn ssh -p [lindex $argv 0] [lindex $argv 1]@[lindex $argv 2]
expect {
        "(yes/no)?"
        {send "yes\n";exp_continue}
        "password:"
        {send "[password]\n"}
}
interact

xxx/xxx.sh [port] [username] [ip]

cmd

创建空白分支

git checkout --orphan [branchName]

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.