Skip to content

Instantly share code, notes, and snippets.

import * as React from 'react';
import cx from 'classnames';
import {
Popover, IPopoverProps,
PopoverInteractionKind,
Position
} from '@blueprintjs/core';
import './NotifyPopover.scss';
interface IProps extends IPopoverProps{
@treecy
treecy / typescript_mappedType.ts
Last active April 19, 2019 07:03
Typescript predefined mapped type
/**
* Make all properties in T optional
*/
type Partial<T> = {
[P in keyof T]?: T[P];
};
/**
* Make all properties in T required
*/
@treecy
treecy / .eslintrc.js
Last active May 29, 2023 14:19
ESLint for both js and ts
module.exports = {
parser: 'babel-eslint',
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
}
},
@treecy
treecy / Variadic_Tuple_Types.ts
Last active July 8, 2020 00:13
[Typescript Use Case] Typescript use case collection
/* Variadic Tuple Types (generic tuple with spread) */
function tail<T extends any[]>(arr: readonly [any, ...T]) {
const [_ignored, ...rest] = arr;
return rest;
}
const myTuple = [1, 2, 3, 4] as const;
const myArray = ["hello", "world"];