Merge branch 'master' into vuex-i18n

This commit is contained in:
Cedric Kemp
2017-10-31 17:59:53 -04:00
13 changed files with 191 additions and 11 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
language: node_js
node_js:
- node
- 8
sudo: false
+67
View File
@@ -0,0 +1,67 @@
import * as args from "args";
args
.option("opt1", "desc")
.option("opt2", "desc", false, (value: any): any => value)
.options([
{
name: 'opt3',
description: 'desc',
defaultValue: 1,
init: (value: any) => { },
},
{
name: 'opt4',
description: 'desc',
},
])
.command("cm1", "desc")
.command("cm2", "desc", (value: any): void => { }, ['a'])
.example("ex1", "desc")
.examples([
{
usage: "ex2",
description: "desc",
},
]);
args.parse(['~/bin/node', '~/dir', 'arg', '--param'], {
help: true,
name: "name",
version: true,
usageFilter: (a: any): any => a,
value: "value",
mri: {
args: ['a'],
alias: {
a: "b",
c: ['d'],
},
boolean: ['wat'],
default: {
foo: 'bar',
},
string: ['zulu'],
unknown: (param: string): boolean => true,
},
minimist: {
string: ['string'],
boolean: ['string'],
alias: {
bar: 'foo',
foo: ['bar1', 'bar2'],
},
default: {
foo: 'bar',
},
stopEarly: true,
"--": false,
unknown: (param: string): boolean => true,
},
mainColor: "yellow",
subColor: "dim"
});
args.showHelp();
const x: string = args.sub[0];
+72
View File
@@ -0,0 +1,72 @@
// Type definitions for args 3.0
// Project: https://github.com/leo/args#readme
// Definitions by: Slessi <https://github.com/Slessi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare const c: args;
export = c;
interface args {
sub: string[];
option(name: string | [string, string], description: string, defaultValue?: any, init?: OptionInitFunction): args;
options(list: Option[]): args;
command(name: string, description: string, init?: (name: string, sub: string[], options: ConfigurationOptions) => void, aliases?: string[]): args;
example(usage: string, description: string): args;
examples(list: Example[]): args;
parse(argv: string[], options?: ConfigurationOptions): { [key: string]: any };
showHelp(): void;
}
type OptionInitFunction = (value: any) => any;
interface MriOptions {
args?: string[];
alias?: {
[key: string]: string | string[]
};
boolean?: string | string[];
default?: {
[key: string]: any
};
string?: string | string[];
unknown?: (param: string) => boolean;
}
interface MinimistOptions {
string?: string | string[];
boolean?: boolean | string | string[];
alias?: {
[key: string]: string | string[]
};
default?: {
[key: string]: any
};
stopEarly?: boolean;
"--"?: boolean;
unknown?: (param: string) => boolean;
}
interface ConfigurationOptions {
help?: boolean;
name?: string;
version?: boolean;
usageFilter?: (output: any) => any;
value?: string;
mri: MriOptions;
minimist?: MinimistOptions;
mainColor: string | string[];
subColor: string | string[];
}
interface Option {
name: string | [string, string];
description: string;
init?: OptionInitFunction;
defaultValue?: any;
}
interface Example {
usage: string;
description: string;
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"args-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+7 -2
View File
@@ -165,7 +165,12 @@ function CommonMethodsInEventStreamsAndProperties() {
{
// Calculator for grouped consecutive values until group is cancelled:
var events = [
interface Event {
id:number;
type:string;
val?:number;
}
var events: Event[] = [
{id: 1, type: "add", val: 3},
{id: 2, type: "add", val: -1},
{id: 1, type: "add", val: 2},
@@ -177,7 +182,7 @@ function CommonMethodsInEventStreamsAndProperties() {
{id: 1, type: "cancel"}
],
keyF = (event:{id:number}) => event.id,
limitF = (groupedStream:Bacon.EventStream<string, {id:number; type:string; val?:number}>) => {
limitF = (groupedStream:Bacon.EventStream<string, Event>) => {
var cancel = groupedStream.filter(x => x.type === "cancel").take(1),
adds = groupedStream.filter(x => x.type === "add");
return adds.takeUntil(cancel).map(x => x.val);
+1 -1
View File
@@ -172,7 +172,7 @@ interface Cheerio {
empty(): Cheerio;
html(): string;
html(): string | null;
html(html: string): Cheerio;
text(): string;
+2 -1
View File
@@ -7030,8 +7030,9 @@ declare namespace chrome.webNavigation {
/**
* The ID of the process runs the renderer for this tab.
* @since Chrome 22.
* @deprecated since Chrome 49. Frames are now uniquely identified by their tab ID and frame ID; the process ID is no longer needed and therefore ignored.
*/
processId: number;
processId?: number;
/** The ID of the tab in which the frame is. */
tabId: number;
/** The ID of the frame in the given tab. */
+1
View File
@@ -437,6 +437,7 @@ export class ShallowWrapper<P = {}, S = {}> {
parent(): ShallowWrapper<any, any>;
}
// tslint:disable-next-line no-empty-interface
export interface ReactWrapper<P = {}, S = {}> extends CommonWrapper<P, S> {}
export class ReactWrapper<P = {}, S = {}> {
constructor(nodes: JSX.Element | JSX.Element[], root?: ReactWrapper, options?: MountRendererProps);
+11 -2
View File
@@ -4,6 +4,7 @@
// Leon Yu <https://github.com/leonyu>
// Sukhdeep Singh <https://github.com/SinghSukhdeep>
// Jean-Francois Cere <https://github.com/jfcere>
// Sebastien Cote <https://github.com/scote>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -555,9 +556,17 @@ interface JQuery {
* Collapsibles are accordion elements that expand when clicked on.
* They allow you to hide content that is not immediately relevant to the user.
*
* @param CollapsibleOptions options the collapsible options
* @param CollapsibleOptions | string options the collapsible options or the string "destroy" to destroy the collapsible
*/
collapsible(options?: Materialize.CollapsibleOptions): JQuery;
collapsible(options?: Materialize.CollapsibleOptions | string): JQuery;
/**
* Programmatically trigger an event on a selected index
*
* @param string method the string "open" or "close" to open or to close the collapsible element on specified index
* @param number index the element index to trigger "open" or "close" function
*/
collapsible(method: string, index: number): JQuery;
/**
* Tooltips are small, interactive, textual hints for mainly graphical elements.
@@ -39,6 +39,8 @@ let collapseHtml = '<ul class="collapsible" data-collapsible="accordion">' +
$(collapseHtml).collapsible({ accordion: false, onClose: () => { alert('Closed'); } });
$(collapseHtml).collapsible({ accordion: true, onOpen: () => { alert('Opened'); } });
$(collapseHtml).collapsible('destroy');
$(collapseHtml).collapsible('open', 0);
// Dialogs - Toasts
Materialize.toast('I am a toast!', 4000);
@@ -45,12 +45,11 @@ interface StartScreenNavigationParams {
s: string;
}
interface StartScreenProps extends NavigationScreenProps<StartScreenNavigationParams> { }
/**
* @desc Simple screen component class with typed component props that should
* receive the navigation prop from the AppNavigator.
*/
class StartScreen extends React.Component<StartScreenProps> {
class StartScreen extends React.Component<NavigationScreenProps<StartScreenNavigationParams>> {
render() {
// Implicit type checks.
const navigationStateParams: StartScreenNavigationParams = this.props.navigation.state.params;
+2 -2
View File
@@ -23,7 +23,7 @@ const initialStateLoader = createLoader(storageEngine);
const storageMiddleware = createMiddleware(storageEngine, [], []);
const store = applyMiddleware(storageMiddleware)(createStore)(enhancedReducer);
const store = applyMiddleware(storageMiddleware)<TestState>(createStore)(enhancedReducer);
initialStateLoader(store).then(() => {
// render app
@@ -33,7 +33,7 @@ initialStateLoader(store).then(() => {
// Test for React Native Async Storage engine
const storageEngineReactNative = createReactNativeAsyncStorageEngine("test");
const storageMiddlewareReactNative = createMiddleware(storageEngine);
const storeReactNative = applyMiddleware(storageMiddlewareReactNative)(createStore)(enhancedReducer);
const storeReactNative = applyMiddleware(storageMiddlewareReactNative)<TestState>(createStore)(enhancedReducer);
initialStateLoader(storeReactNative).then(() => {
// render app
})