Merge branch 'master' of github.com:magnostherobot/DefinitelyTyped

This commit is contained in:
Tom Harley
2018-02-17 17:50:28 +00:00
36 changed files with 1656 additions and 488 deletions
+20
View File
@@ -29,3 +29,23 @@ cookie.removeSpecific(['a', 'b'], {path: '/search'});
cookie.empty();
cookie.all();
cookie.utils;
cookie.utils.isArray('a');
cookie.utils.isArray([]);
cookie.utils.isObject('a');
cookie.utils.isObject({});
cookie.utils.toArray({});
cookie.utils.toArray([]);
cookie.utils.getKeys({});
cookie.utils.encode('a');
cookie.utils.decode('a');
cookie.utils.retrieve('a', 'b');
cookie.defaults;
cookie.defaults.expires = 1;
cookie.defaults.expires = new Date;
cookie.defaults.expires = 'Wed, 07 Feb 2018 17:00:26 GMT';
cookie.defaults.domain = 'example.com';
cookie.defaults.path = '/foo';
cookie.defaults.secure = true;
+25
View File
@@ -17,6 +17,23 @@ declare module 'cookiejs' {
declare function cookie(key : string, fallback?: string) : string;
declare function cookie(keys : string[], fallback?: string) : string;
interface UtilStatic {
isArray: (value: any) => boolean;
isObject: (value: any) => boolean;
toArray: (...args: any[]) => any[];
getKeys: (value: {}) => any[];
encode: (value: string) => string;
decode: (value: string) => string;
retrieve: (x: string, y: string) => string;
}
interface Options {
expires: number | string | Date,
domain: string,
path: string,
secure: boolean,
}
declare namespace cookie {
/**
* Create a cookie. The value will automatically be escaped.
@@ -57,4 +74,12 @@ declare namespace cookie {
* Test if cookies are enabled
*/
export function enabled() : boolean;
/**
* Utility methods
*/
export var utils: UtilStatic;
/**
* Set default options
*/
export var defaults: Options;
}
@@ -19,6 +19,6 @@
},
"files": [
"index.d.ts",
"dat-gui-tests.ts"
"dat.gui-tests.ts"
]
}
+3 -2
View File
@@ -20,6 +20,7 @@ declare module 'ember' {
import { Registry as ServiceRegistry } from '@ember/service';
import { Registry as ControllerRegistry } from '@ember/controller';
import ModuleComputed from '@ember/object/computed';
// Get an alias to the global Array type to use in inner scope below.
type GlobalArray<T> = T[];
@@ -27,7 +28,7 @@ declare module 'ember' {
/**
* Deconstructs computed properties into the types which would be returned by `.get()`.
*/
type ComputedProperties<T> = { [K in keyof T]: Ember.ComputedProperty<T[K]> | T[K] };
type ComputedProperties<T> = { [K in keyof T]: Ember.ComputedProperty<T[K]> | ModuleComputed<T[K]> | T[K] };
/**
* Check that any arguments to `create()` match the type's properties.
@@ -1523,7 +1524,7 @@ declare module 'ember' {
* Remove an object at the specified index using the `replace()` primitive
* method. You can pass either a single index, or a start and a length.
*/
removeAt(start: number, len: number): this;
removeAt(start: number, len?: number): this;
/**
* Push the object onto the end of the array. Works just like `push()` but it
* is KVO-compliant.
+6 -2
View File
@@ -1,6 +1,6 @@
import Ember from 'ember';
import Component from '@ember/component';
import { or } from '@ember/object/computed';
import Computed, { alias, or } from '@ember/object/computed';
import { assertType } from './lib/assert';
const Person = Ember.Object.extend({
@@ -50,7 +50,9 @@ const Person = Ember.Object.extend({
}).property('firstName')
.meta({ foo: 'bar' })
.volatile()
.readOnly()
.readOnly(),
explicitlyDeclared: alias('fullName') as Computed<string>,
});
const person = Person.create({
@@ -68,6 +70,7 @@ assertType<Ember.ComputedProperty<string>>(person.fullNameWritable);
assertType<Ember.ComputedProperty<string>>(person.fullNameGetOnly);
assertType<Ember.ComputedProperty<string>>(person.fullNameSetOnly);
assertType<Ember.ComputedProperty<string>>(person.combinators);
assertType<Ember.ComputedProperty<string>>(person.explicitlyDeclared);
assertType<string>(person.get('firstName'));
assertType<number>(person.get('age'));
@@ -78,6 +81,7 @@ assertType<string>(person.get('fullNameWritable'));
assertType<string>(person.get('fullNameGetOnly'));
assertType<string>(person.get('fullNameSetOnly'));
assertType<string>(person.get('combinators'));
assertType<string>(person.get('explicitlyDeclared'));
assertType<{ firstName: string, fullName: string, age: number }>(person.getProperties('firstName', 'fullName', 'age'));
+208 -4
View File
@@ -1,4 +1,5 @@
import * as React from 'react';
import { Text } from 'react-native';
import {
Accelerometer,
@@ -12,6 +13,7 @@ import {
BlurView,
Brightness,
Camera,
CameraObject,
DocumentPicker,
Facebook,
FacebookAds,
@@ -19,7 +21,13 @@ import {
ImagePicker,
ImageManipulator,
FaceDetector,
Svg
Svg,
IntentLauncherAndroid,
KeepAwake,
LinearGradient,
Permissions,
registerRootComponent,
ScreenOrientation
} from 'expo';
Accelerometer.addListener((obj) => {
@@ -36,7 +44,7 @@ Amplitude.setUserProperties({key: 1});
Amplitude.clearUserProperties();
Amplitude.logEvent('name');
Amplitude.logEventWithProperties('event', {key: 'value'});
Amplitude.setGroup('type', {key: 'value'});
Amplitude.setGroup('type', ['value']);
const asset = Asset.fromModule(1);
asset.downloadAsync();
@@ -86,8 +94,83 @@ Audio.setAudioModeAsync({
allowsRecordingIOS: true
});
Audio.setIsEnabledAsync(true);
Audio.INTERRUPTION_MODE_IOS_MIX_WITH_OTHERS === 0;
Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX === 1;
Audio.INTERRUPTION_MODE_IOS_DUCK_OTHERS === 2;
Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX === 1;
Audio.INTERRUPTION_MODE_ANDROID_DUCK_OTHERS === 2;
Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_DEFAULT === 0;
Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_THREE_GPP === 1;
Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_MPEG_4 === 2;
Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AMR_NB === 3;
Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AMR_WB === 4;
Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AAC_ADIF === 5;
Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AAC_ADTS === 6;
Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_RTP_AVP === 7;
Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_MPEG2TS === 8;
Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_WEBM === 9;
Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_DEFAULT === 0;
Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AMR_NB === 1;
Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AMR_WB === 2;
Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AAC === 3;
Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_HE_AAC === 4;
Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AAC_ELD === 5;
Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_VORBIS === 6;
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_LINEARPCM === 'lpcm';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_AC3 === 'ac-3';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_60958AC3 === 'cac3';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_APPLEIMA4 === 'ima4';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC === 'aac ';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4CELP === 'celp';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4HVXC === 'hvxc';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4TWINVQ === 'twvq';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MACE3 === 'MAC3';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MACE6 === 'MAC6';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_ULAW === 'ulaw';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_ALAW === 'alaw';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_QDESIGN === 'QDMC';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_QDESIGN2 === 'QDM2';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_QUALCOMM === 'Qclp';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEGLAYER1 === '.mp1';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEGLAYER2 === '.mp2';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEGLAYER3 === '.mp3';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_APPLELOSSLESS === 'alac';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_HE === 'aach';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_LD === 'aacl';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_ELD === 'aace';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_ELD_SBR === 'aacf';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_ELD_V2 === 'aacg';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_HE_V2 === 'aacp';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_SPATIAL === 'aacs';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_AMR === 'samr';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_AMR_WB === 'sawb';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_AUDIBLE === 'AUDB';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_ILBC === 'ilbc';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_DVIINTELIMA === 0x6d730011;
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MICROSOFTGSM === 0x6d730031;
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_AES3 === 'aes3';
Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_ENHANCEDAC3 === 'ec-3';
Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_MIN === 0;
Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_LOW === 0x20;
Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_MEDIUM === 0x40;
Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_HIGH === 0x60;
Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_MAX === 0x7f;
Audio.RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_CONSTANT === 0;
Audio.RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_LONG_TERM_AVERAGE === 1;
Audio.RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_VARIABLE_CONSTRAINED === 2;
Audio.RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_VARIABLE === 3;
Audio.RECORDING_OPTIONS_PRESET_HIGH_QUALITY;
Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY;
async () => {
const result = await Audio.Sound.create('uri', {
const result = await Audio.Sound.create({uri: 'uri'}, {
volume: 0.5,
rate: 0.6
}, null, true);
@@ -103,7 +186,7 @@ async () => {
}
const _status = await sound.getStatusAsync();
await sound.loadAsync('uri');
await sound.loadAsync({uri: 'uri'});
};
() => (
@@ -344,3 +427,124 @@ async () => {
</Svg.Defs>
</Svg>
);
IntentLauncherAndroid.ACTION_ACCESSIBILITY_SETTINGS === 'android.settings.ACCESSIBILITY_SETTINGS';
IntentLauncherAndroid.ACTION_APP_NOTIFICATION_REDACTION === 'android.settings.ACTION_APP_NOTIFICATION_REDACTION';
IntentLauncherAndroid.ACTION_CONDITION_PROVIDER_SETTINGS === 'android.settings.ACTION_CONDITION_PROVIDER_SETTINGS';
IntentLauncherAndroid.ACTION_NOTIFICATION_LISTENER_SETTINGS === 'android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS';
IntentLauncherAndroid.ACTION_PRINT_SETTINGS === 'android.settings.ACTION_PRINT_SETTINGS';
IntentLauncherAndroid.ACTION_ADD_ACCOUNT_SETTINGS === 'android.settings.ADD_ACCOUNT_SETTINGS';
IntentLauncherAndroid.ACTION_AIRPLANE_MODE_SETTINGS === 'android.settings.AIRPLANE_MODE_SETTINGS';
IntentLauncherAndroid.ACTION_APN_SETTINGS === 'android.settings.APN_SETTINGS';
IntentLauncherAndroid.ACTION_APPLICATION_DETAILS_SETTINGS === 'android.settings.APPLICATION_DETAILS_SETTINGS';
IntentLauncherAndroid.ACTION_APPLICATION_DEVELOPMENT_SETTINGS === 'android.settings.APPLICATION_DEVELOPMENT_SETTINGS';
IntentLauncherAndroid.ACTION_APPLICATION_SETTINGS === 'android.settings.APPLICATION_SETTINGS';
IntentLauncherAndroid.ACTION_APP_NOTIFICATION_SETTINGS === 'android.settings.APP_NOTIFICATION_SETTINGS';
IntentLauncherAndroid.ACTION_APP_OPS_SETTINGS === 'android.settings.APP_OPS_SETTINGS';
IntentLauncherAndroid.ACTION_BATTERY_SAVER_SETTINGS === 'android.settings.BATTERY_SAVER_SETTINGS';
IntentLauncherAndroid.ACTION_BLUETOOTH_SETTINGS === 'android.settings.BLUETOOTH_SETTINGS';
IntentLauncherAndroid.ACTION_CAPTIONING_SETTINGS === 'android.settings.CAPTIONING_SETTINGS';
IntentLauncherAndroid.ACTION_CAST_SETTINGS === 'android.settings.CAST_SETTINGS';
IntentLauncherAndroid.ACTION_DATA_ROAMING_SETTINGS === 'android.settings.DATA_ROAMING_SETTINGS';
IntentLauncherAndroid.ACTION_DATE_SETTINGS === 'android.settings.DATE_SETTINGS';
IntentLauncherAndroid.ACTION_DEVICE_INFO_SETTINGS === 'android.settings.DEVICE_INFO_SETTINGS';
IntentLauncherAndroid.ACTION_DEVICE_NAME === 'android.settings.DEVICE_NAME';
IntentLauncherAndroid.ACTION_DISPLAY_SETTINGS === 'android.settings.DISPLAY_SETTINGS';
IntentLauncherAndroid.ACTION_DREAM_SETTINGS === 'android.settings.DREAM_SETTINGS';
IntentLauncherAndroid.ACTION_HARD_KEYBOARD_SETTINGS === 'android.settings.HARD_KEYBOARD_SETTINGS';
IntentLauncherAndroid.ACTION_HOME_SETTINGS === 'android.settings.HOME_SETTINGS';
IntentLauncherAndroid.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS === 'android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS';
IntentLauncherAndroid.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS === 'android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS';
IntentLauncherAndroid.ACTION_INPUT_METHOD_SETTINGS === 'android.settings.INPUT_METHOD_SETTINGS';
IntentLauncherAndroid.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS === 'android.settings.INPUT_METHOD_SUBTYPE_SETTINGS';
IntentLauncherAndroid.ACTION_INTERNAL_STORAGE_SETTINGS === 'android.settings.INTERNAL_STORAGE_SETTINGS';
IntentLauncherAndroid.ACTION_LOCALE_SETTINGS === 'android.settings.LOCALE_SETTINGS';
IntentLauncherAndroid.ACTION_LOCATION_SOURCE_SETTINGS === 'android.settings.LOCATION_SOURCE_SETTINGS';
IntentLauncherAndroid.ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS === 'android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS';
IntentLauncherAndroid.ACTION_MANAGE_APPLICATIONS_SETTINGS === 'android.settings.MANAGE_APPLICATIONS_SETTINGS';
IntentLauncherAndroid.ACTION_MANAGE_DEFAULT_APPS_SETTINGS === 'android.settings.MANAGE_DEFAULT_APPS_SETTINGS';
IntentLauncherAndroid.ACTION_MEMORY_CARD_SETTINGS === 'android.settings.MEMORY_CARD_SETTINGS';
IntentLauncherAndroid.ACTION_MONITORING_CERT_INFO === 'android.settings.MONITORING_CERT_INFO';
IntentLauncherAndroid.ACTION_NETWORK_OPERATOR_SETTINGS === 'android.settings.NETWORK_OPERATOR_SETTINGS';
IntentLauncherAndroid.ACTION_NFCSHARING_SETTINGS === 'android.settings.NFCSHARING_SETTINGS';
IntentLauncherAndroid.ACTION_NFC_PAYMENT_SETTINGS === 'android.settings.NFC_PAYMENT_SETTINGS';
IntentLauncherAndroid.ACTION_NFC_SETTINGS === 'android.settings.NFC_SETTINGS';
IntentLauncherAndroid.ACTION_NIGHT_DISPLAY_SETTINGS === 'android.settings.NIGHT_DISPLAY_SETTINGS';
IntentLauncherAndroid.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS === 'android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS';
IntentLauncherAndroid.ACTION_NOTIFICATION_SETTINGS === 'android.settings.NOTIFICATION_SETTINGS';
IntentLauncherAndroid.ACTION_PAIRING_SETTINGS === 'android.settings.PAIRING_SETTINGS';
IntentLauncherAndroid.ACTION_PRIVACY_SETTINGS === 'android.settings.PRIVACY_SETTINGS';
IntentLauncherAndroid.ACTION_QUICK_LAUNCH_SETTINGS === 'android.settings.QUICK_LAUNCH_SETTINGS';
IntentLauncherAndroid.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS === 'android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS';
IntentLauncherAndroid.ACTION_SECURITY_SETTINGS === 'android.settings.SECURITY_SETTINGS';
IntentLauncherAndroid.ACTION_SETTINGS === 'android.settings.SETTINGS';
IntentLauncherAndroid.ACTION_SHOW_ADMIN_SUPPORT_DETAILS === 'android.settings.SHOW_ADMIN_SUPPORT_DETAILS';
IntentLauncherAndroid.ACTION_SHOW_INPUT_METHOD_PICKER === 'android.settings.SHOW_INPUT_METHOD_PICKER';
IntentLauncherAndroid.ACTION_SHOW_REGULATORY_INFO === 'android.settings.SHOW_REGULATORY_INFO';
IntentLauncherAndroid.ACTION_SHOW_REMOTE_BUGREPORT_DIALOG === 'android.settings.SHOW_REMOTE_BUGREPORT_DIALOG';
IntentLauncherAndroid.ACTION_SOUND_SETTINGS === 'android.settings.SOUND_SETTINGS';
IntentLauncherAndroid.ACTION_STORAGE_MANAGER_SETTINGS === 'android.settings.STORAGE_MANAGER_SETTINGS';
IntentLauncherAndroid.ACTION_SYNC_SETTINGS === 'android.settings.SYNC_SETTINGS';
IntentLauncherAndroid.ACTION_SYSTEM_UPDATE_SETTINGS === 'android.settings.SYSTEM_UPDATE_SETTINGS';
IntentLauncherAndroid.ACTION_TETHER_PROVISIONING_UI === 'android.settings.TETHER_PROVISIONING_UI';
IntentLauncherAndroid.ACTION_TRUSTED_CREDENTIALS_USER === 'android.settings.TRUSTED_CREDENTIALS_USER';
IntentLauncherAndroid.ACTION_USAGE_ACCESS_SETTINGS === 'android.settings.USAGE_ACCESS_SETTINGS';
IntentLauncherAndroid.ACTION_USER_DICTIONARY_INSERT === 'android.settings.USER_DICTIONARY_INSERT';
IntentLauncherAndroid.ACTION_USER_DICTIONARY_SETTINGS === 'android.settings.USER_DICTIONARY_SETTINGS';
IntentLauncherAndroid.ACTION_USER_SETTINGS === 'android.settings.USER_SETTINGS';
IntentLauncherAndroid.ACTION_VOICE_CONTROL_AIRPLANE_MODE === 'android.settings.VOICE_CONTROL_AIRPLANE_MODE';
IntentLauncherAndroid.ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE === 'android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE';
IntentLauncherAndroid.ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE === 'android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE';
IntentLauncherAndroid.ACTION_VOICE_INPUT_SETTINGS === 'android.settings.VOICE_INPUT_SETTINGS';
IntentLauncherAndroid.ACTION_VPN_SETTINGS === 'android.settings.VPN_SETTINGS';
IntentLauncherAndroid.ACTION_VR_LISTENER_SETTINGS === 'android.settings.VR_LISTENER_SETTINGS';
IntentLauncherAndroid.ACTION_WEBVIEW_SETTINGS === 'android.settings.WEBVIEW_SETTINGS';
IntentLauncherAndroid.ACTION_WIFI_IP_SETTINGS === 'android.settings.WIFI_IP_SETTINGS';
IntentLauncherAndroid.ACTION_WIFI_SETTINGS === 'android.settings.WIFI_SETTINGS';
IntentLauncherAndroid.ACTION_WIRELESS_SETTINGS === 'android.settings.WIRELESS_SETTINGS';
IntentLauncherAndroid.ACTION_ZEN_MODE_AUTOMATION_SETTINGS === 'android.settings.ZEN_MODE_AUTOMATION_SETTINGS';
IntentLauncherAndroid.ACTION_ZEN_MODE_EVENT_RULE_SETTINGS === 'android.settings.ZEN_MODE_EVENT_RULE_SETTINGS';
IntentLauncherAndroid.ACTION_ZEN_MODE_EXTERNAL_RULE_SETTINGS === 'android.settings.ZEN_MODE_EXTERNAL_RULE_SETTINGS';
IntentLauncherAndroid.ACTION_ZEN_MODE_PRIORITY_SETTINGS === 'android.settings.ZEN_MODE_PRIORITY_SETTINGS';
IntentLauncherAndroid.ACTION_ZEN_MODE_SCHEDULE_RULE_SETTINGS === 'android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS';
IntentLauncherAndroid.ACTION_ZEN_MODE_SETTINGS === 'android.settings.ZEN_MODE_SETTINGS';
KeepAwake.activate();
KeepAwake.deactivate();
() => (
<LinearGradient
colors={['#fff']}
start={[1, 1]}
end={[3, 3]}
locations={[1, 2]} />
);
Permissions.CAMERA === 'camera';
Permissions.CAMERA_ROLL === 'cameraRoll';
Permissions.AUDIO_RECORDING === 'audioRecording';
Permissions.CONTACTS === 'contacts';
Permissions.NOTIFICATIONS === 'remoteNotifications';
Permissions.REMOTE_NOTIFICATIONS === 'remoteNotifications';
Permissions.SYSTEM_BRIGHTNESS === 'systemBrightness';
async () => {
const result = await Permissions.askAsync(Permissions.CAMERA);
result.status === 'granted';
result.status === 'denied';
result.status === 'undetermined';
result.expires === 'never';
};
ScreenOrientation.Orientation.ALL;
ScreenOrientation.allow(ScreenOrientation.Orientation.ALL);
class __TestEntry__ extends React.Component {
render() {
return(
<Text>test</Text>
);
}
}
registerRootComponent(__TestEntry__);
+820 -409
View File
File diff suppressed because it is too large Load Diff
+7 -1
View File
@@ -1 +1,7 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"void-return": false,
"max-line-length": false
}
}
@@ -0,0 +1,93 @@
import { createBatchResolver, ResolverFunction } from "graphql-resolve-batch";
interface SomeTestSource {
someSourceProp: string;
}
interface SomeTestArgs {
someArg: string;
}
interface SomeTestContext {
someContextProp: string;
}
interface SomeTestResult {
someTestResultProp: string;
}
const withSourceAndResultTyped = createBatchResolver<
SomeTestSource,
SomeTestResult
>((sources, _, __) => {
return sources.map(source => {
const res: SomeTestResult = {
someTestResultProp: ""
};
return res;
});
});
const withSourceAndResultTypedAsPromise = createBatchResolver<
SomeTestSource,
SomeTestResult
>((sources, _, __) => {
// $ExpectType ReadonlyArray<SomeTestSource>
const verifySources = sources;
return sources.map(source => {
return new Promise<SomeTestResult>(resolve => {
const res: SomeTestResult = {
someTestResultProp: ""
};
resolve(res);
});
});
});
const withSourceAndArgsAndResultTyped = createBatchResolver<
SomeTestSource,
SomeTestResult,
SomeTestArgs
>((sources, args, _) => {
// $ExpectType ReadonlyArray<SomeTestSource>
const verifySources = sources;
// $ExpectType string
const verifyArgs = args.someArg;
return sources.map(source => {
return new Promise<SomeTestResult>(resolve => {
const res: SomeTestResult = {
someTestResultProp: ""
};
resolve(res);
});
});
});
const withSourceAndArgsAndContextTyped = createBatchResolver<
SomeTestSource,
SomeTestResult,
SomeTestArgs,
SomeTestContext
>((sources, args, context) => {
// $ExpectType ReadonlyArray<SomeTestSource>
const verifySources = sources;
// $ExpectType string
const verifyArgs = args.someArg;
// $ExpectType string
const verifyContext = context.someContextProp;
return sources.map(source => {
return new Promise<SomeTestResult>(resolve => {
const res: SomeTestResult = {
someTestResultProp: ""
};
resolve(res);
});
});
});
+26
View File
@@ -0,0 +1,26 @@
// Type definitions for graphql-resolve-batch 1.0
// Project: https://github.com/calebmer/graphql-resolve-batch#readme
// Definitions by: Rutger Hendrickx <https://github.com/nayni>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
export function createBatchResolver<
TSource,
TReturn,
TArgs = any,
TContext = any
>(
batchResolveFn: BatchResolveFunction<TSource, TArgs, TContext, TReturn>
): ResolverFunction<TSource, TArgs, TContext, TReturn>;
export type ResolverFunction<TSource, TArgs, TContext, TReturn> = (
source: TSource,
args: TArgs,
context: TContext
) => Promise<TReturn>;
export type BatchResolveFunction<TSource, TArgs, TContext, TReturn> = (
sources: ReadonlyArray<TSource>,
args: TArgs,
context: TContext
) => TReturn[] | Array<Promise<TReturn>>;
+16
View File
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"strictFunctionTypes": true,
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "graphql-resolve-batch-tests.ts"]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+1 -1
View File
@@ -470,7 +470,7 @@ declare namespace jest {
* and it is set to a certain numeric value.
*/
toHaveLength(expected: number): R;
toHaveProperty(propertyPath: string, value?: any): R;
toHaveProperty(propertyPath: string | any[], value?: any): R;
/**
* Check that a string matches a regular expression.
*/
+16
View File
@@ -642,6 +642,22 @@ describe('rejects', () => {
});
});
// https://facebook.github.io/jest/docs/en/expect.html#tohavepropertykeypath-value
describe('toHaveProperty', () => {
it('it accepts a keyPath as string', () => {
expect({ a: { b: {}}}).toHaveProperty('a');
});
it('it accepts a keyPath as string with dot notation', () => {
expect({ a: { b: {}}}).toHaveProperty('a.b');
});
it('it accepts a keyPath as an array', () => {
expect({ a: { b: {}}}).toHaveProperty(['a', 'b']);
});
it('it accepts a keyPath as an array containing non-string values', () => {
expect({ a: ['b']}).toHaveProperty(['a', 0]);
});
});
class MyTransformer implements jest.Transformer {
process(text: string, path: string) {
return `
+105 -20
View File
@@ -1,28 +1,113 @@
// Type definitions for jsonrpc-serializer 0.2
// Project: https://github.com/soggie/jsonrpc-serializer#readme
// Definitions by: Akim95 <https://github.com/Akim95>
// Project: https://github.com/soggie/jsonrpc-serializer
// Definitions by: Akim95 <https://github.com/Akim95>, many20 <https://github.com/many20>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.5
export function request<T>(id: string | number, method: string, params?: T): string;
export function notification<T>(method: string, params?: T): string;
export function success<T>(id: string, result: T): string;
export function error<T>(id: string, error: T): string;
export function deserialize<T>(msg: string): T;
export function requestObject<T>(id: string | number, method: string, params?: T): string;
export function notificationObject<T>(method: string, params?: T): string;
export function successObject<T>(id: string, result: T): string;
export function errorObject<T>(id: string, error: T): string;
export function deserializeObject<T>(msg: T): void;
export type PayloadType = 'request' | 'notification' | 'success' | 'error';
// export const PayloadType = {
// request: 'request' as PayloadType,
// notification: 'notification' as PayloadType,
// success: 'success' as PayloadType,
// error: 'error' as PayloadType
// };
export const errorHandler: any;
export interface DeserializeObject {
type: PayloadType;
payload: RequestPayloadObject | NotificationPayloadObject | SuccessPayloadObject | ErrorPayloadObject;
}
export interface PayloadObject {
id?: string | number;
method?: string;
params?: any;
result?: any;
error?: SerializerError;
}
export interface RequestPayloadObject extends PayloadObject {
id: string;
method: string;
params: any;
}
export interface NotificationPayloadObject extends PayloadObject {
method: string;
params: any;
}
export interface SuccessPayloadObject extends PayloadObject {
id: string | number;
result: any;
}
export interface ErrorPayloadObject extends PayloadObject {
id: string | number;
error: SerializerError;
}
export interface SerializerError extends Error {
name: string;
code: number;
message: string;
data?: any[];
}
export function request(id: string | number, method: string, params?: any): string;
export function notification(method: string, params?: any): string;
export function success(id: string | number, result: any): string;
export function error(id: string | number, error: err.JsonRpcError): string;
export function deserialize(msg: string): DeserializeObject;
export function requestObject(id: string | number, method: string, params?: any): PayloadObject;
export function notificationObject(method: string, params?: any): PayloadObject;
export function successObject(id: string | number, result: any): PayloadObject;
export function errorObject(id: string | number, error: SerializerError): PayloadObject;
export function deserializeObject(msg: PayloadObject): DeserializeObject;
export type errorHandler = (errors: string[] | null) => void;
export namespace err {
class JsonRpcError {
constructor(msg: string);
serialize(): any;
type ErrorName = 'JsonRpcError' | 'ParseError' | 'InvalidRequestError' | 'MethodNotFoundError' | 'InvalidParamsError';
// const ErrorName = {
// JsonRpcError: 'JsonRpcError' as ErrorName,
// ParseError: 'ParseError' as ErrorName,
// InvalidRequestError: 'InvalidRequestError' as ErrorName,
// MethodNotFoundError: 'MethodNotFoundError' as ErrorName,
// InvalidParamsError: 'InvalidParamsError' as ErrorName
// };
type ErrorCode = -32603 | -32700 | -32600 | -32601 | -32602;
// const ErrorCode = {
// JsonRpcError: -32603 as ErrorCode,
// ParseError: -32700 as ErrorCode,
// InvalidRequestError: -32600 as ErrorCode,
// MethodNotFoundError: -32601 as ErrorCode,
// InvalidParamsError: -32602 as ErrorCode
// };
class JsonRpcError extends Error implements SerializerError {
name: string | ErrorName;
code: number | ErrorCode;
message: string;
data?: any[];
constructor(msg: string, ...args: any[]);
serialize(): string;
}
class InvalidParamsError extends JsonRpcError {
constructor(...args: any[]);
}
class InvalidRequestError extends JsonRpcError {
constructor(...args: any[]);
}
class MethodNotFoundError extends JsonRpcError {
constructor(...args: any[]);
}
class ParseError extends JsonRpcError {
constructor(...args: any[]);
}
class InvalidParamsError {}
class InvalidRequestError {}
class MethodNotFoundError {}
class ParseError {}
}
@@ -1,3 +1,4 @@
import * as uuid from 'node-uuid';
import * as jrs from 'jsonrpc-serializer';
// request tests
@@ -46,3 +47,40 @@ const request = {
jrs.deserialize(JSON.stringify(request));
jrs.deserializeObject(request);
// ---
const request2 = jrs.request('request-id', 'request-method');
// ---> "{\"jsonrpc\":\"2.0\",\"id\":\"request-id\",\"method:\":\"request-method\"}"
const ok1 = "{\"jsonrpc\":\"2.0\",\"id\":\"request-id\",\"result\":\"success!!\"}";
const response1 = jrs.deserialize(ok1);
// ---
const payload2 = jrs.request(
uuid.v4(), // generates a V4 UUID string
'saveUser', // the method to call
{
name : 'Ruben Tan',
email : 'foo@bar.com',
race : 'unicorn'
}
);
// ---
const payload3 = jrs.notification(
'newMessage', // the method to call
{
subject : 'Test message',
message : 'This is a test message'
}
);
// ---
const err1 = new jrs.err.JsonRpcError('This is an error');
const str1 = err1.serialize();
+2 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for Moment-range.js 3.0
// Type definitions for Moment-range.js 3.1
// Project: https://github.com/gf3/moment-range
// Definitions by: Bart van den Burg <https://github.com/Burgov>
// Wilgert Velinga <https://github.com/wilgert>
@@ -21,7 +21,7 @@ export class DateRange {
intersect(other: DateRange): DateRange;
add(other: DateRange): DateRange;
add(other: DateRange, options?: { adjacent?: boolean }): DateRange;
subtract(other: DateRange): DateRange[];
+11 -9
View File
@@ -60,18 +60,20 @@ const it10: Iterable<moment.Moment> = range.reverseByRange(range, { exclusive: t
const it11: Iterable<moment.Moment> = range.reverseByRange(range, { exclusive: false, step: 2 });
const res23: momentRange.DateRange = range.add(range2);
const res24: momentRange.DateRange = range.add(range2, {adjacent: true});
const res25: momentRange.DateRange = range.add(range2, {adjacent: false});
const res24: momentRange.DateRange[] = range.subtract(range2);
const res26: momentRange.DateRange[] = range.subtract(range2);
const res25: Date[] = range.toDate();
const res27: Date[] = range.toDate();
const res26: string = range.toString();
const res28: string = range.toString();
const res27: number = range.valueOf();
const res29: number = range.valueOf();
const res28: moment.Moment = range.start;
const res29: moment.Moment = range.end;
const res30: moment.Moment = range.start;
const res31: moment.Moment = range.end;
const res30: boolean = extendedMoment.within(range);
const res31: boolean = extendedMoment().within(range);
const res32: momentRange.DateRange = extendedMoment().range(moment("2011-04-15", "YYYY-MM-DD"), moment("2011-11-27", "YYYY-MM-DD"));
const res32: boolean = extendedMoment.within(range);
const res33: boolean = extendedMoment().within(range);
const res34: momentRange.DateRange = extendedMoment().range(moment("2011-04-15", "YYYY-MM-DD"), moment("2011-11-27", "YYYY-MM-DD"));
+9
View File
@@ -0,0 +1,9 @@
// Type definitions for mongo-sanitize 1.0
// Project: https://github.com/vkarpov15/mongo-sanitize
// Definitions by: Cedric Cazin <https://github.com/CedricCazin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
export function sanitize<T extends object>(v: T): T;
export as namespace mongoSanitize;
@@ -0,0 +1,11 @@
import * as mongoSanitize from 'mongo-sanitize';
const objectSanitized = mongoSanitize.sanitize({ $gt: 5, a: 1 });
const arraySanitized = mongoSanitize.sanitize([1, 2, 3]);
class Clazz {
$gt = 5;
a = 1;
}
const classSanitized = mongoSanitize.sanitize(new Clazz());
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true
},
"files": [
"index.d.ts",
"mongo-sanitize-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+13 -8
View File
@@ -1,4 +1,4 @@
// Type definitions for odata v0.3.4
// Type definitions for odata v0.3
// Project: https://github.com/janhommes/odata
// Definitions by: Jan Hommes <https://github.com/janhommes>, Jean-Christophe Chalte <https://github.com/jcchalte>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -26,14 +26,16 @@ declare module 'odata' {
}
interface OHandler<T> {
inlinecount : number
data : T
inlinecount: number; // if inlinecount is set, here the counting is gold
data: T; // holds the data after an callback
param: {}; // this object holds all parameter for a route
config<T>(options ?: Options) : OHandler<T>
progress<T>(callback : () => any) : OHandler<T>
get<T>(callback ?: (data : T) => void) : Q.Promise<OHandler<T>>
save<T>(callback ?: (data : T) => void) : Q.Promise<OHandler<T>>
get<T>(callback ?: (data : T) => void, errorCallback?: (status: number) => void) : Q.Promise<OHandler<T>>
save<T>(callback ?: (data : T) => void, errorCallback?: (status: number) => void) : Q.Promise<OHandler<T>>
query: () => string;
post<T>(params : any) : OHandler<T>
patch<T>(params : any) : OHandler<T>
@@ -78,11 +80,14 @@ declare module 'odata' {
deleteRef<T>(resource : string, id : string | number) : OHandler<T>
}
interface OFn<T> extends OHandler<T> {
(options ?: string | Options) : OHandler<T>
interface OHandlerStatic {
(): OHandlerStatic;
(options?: string | Options): OHandler<{}>;
config: (config: Options) => OHandlerStatic;
isEndpoint: () => boolean;
}
var o : OFn<{}>;
var o : OHandlerStatic;
export = o
}
+15 -5
View File
@@ -20,6 +20,8 @@ interface Category {
o('http://services.odata.org/V4/OData/OData.svc/Products')
.get<Product>(function(data) {
console.log(data); //returns an array of Product data
}, function(status) {
console.error(status); // error with status
});
@@ -70,7 +72,8 @@ o('http://services.odata.org/V4/OData/OData.svc/Products(2)')
.get<Product>()
.then(function(oHandler) {
console.log(oHandler.data);
}).fail(function(ex) {
})
.fail(function(ex) {
console.log(ex);
});
@@ -114,10 +117,12 @@ o('http://services.odata.org/V4/OData/OData.svc/Products')
.get<Product>()
.then(function(oHandler) {
oHandler.data.Name="NewName";
return(o.save<Product>());
}).then(function(oHandler) {
return(oHandler.save<Product>());
})
.then(function(oHandler) {
console.log(oHandler.data.Name); //NewName
}).fail(function(ex) {
})
.fail(function(ex) {
console.log("error");
});
@@ -132,7 +137,12 @@ o('Products').get<Product>(function(data) {
//same result like the first example on this page
});
const oEequest = o('http://services.odata.org/V4/OData/OData.svc/Products')
.find(2);
const queryString = oEequest.query();
if (queryString !== 'http://services.odata.org/V4/OData/OData.svc/Products(2)') {
throw new Error('assert error');
}
//basic config
o().config({
+29
View File
@@ -0,0 +1,29 @@
// Type definitions for random-number 0.0
// Project: https://github.com/ashnur/random-number
// Definitions by: OpenByteDev <https://github.com/OpenByteDev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
type Generator = (min?: number|null, max?: number|null, integer?: boolean|null) => number;
interface UnparsedOptions {
min?: number;
max?: number;
integer?: boolean;
}
interface Options {
min: number;
max: number;
integer: boolean;
}
interface RandomNumber {
(options?: UnparsedOptions): number;
generator(options?: UnparsedOptions): Generator;
defaults(options?: UnparsedOptions): Options;
}
declare const randomNumber: RandomNumber;
export = randomNumber;
@@ -0,0 +1,58 @@
import rn = require('random-number');
rn();
const options1 = {
min: -1000,
max: 1000,
integer: true
};
rn(options1);
const gen1 = rn.generator({
min: -1000,
max: 1000,
integer: true
});
gen1();
const gen2 = rn.generator({
min: -1000,
max: 1000,
integer: true
});
gen2(500);
gen2(500, null, false);
const options3 = {
min: 9874316514
};
rn(options3);
const options4 = {
max: -9874316514
};
rn(options4);
const options5 = {
integer: true
};
rn(options5);
const options6 = {
min: -10,
max: -1
};
rn(options6);
const options7 = {
min: 1000,
integer: true
};
rn(options7);
const options8 = {
max: 1000,
integer: true
};
rn(options8);
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true
},
"files": [
"index.d.ts",
"random-number-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+33 -9
View File
@@ -1,4 +1,4 @@
// Type definitions for react-beautiful-dnd 3.0
// Type definitions for react-beautiful-dnd 4.0
// Project: https://github.com/atlassian/react-beautiful-dnd
// Definitions by: varHarrie <https://github.com/varHarrie>
// Bradley Ayers <https://github.com/bradleyayers>
@@ -8,12 +8,10 @@
import * as React from 'react';
export type Id = string;
export type DraggableId = Id;
export type DroppableId = Id;
export type TypeId = Id;
export type ZIndex = number | string;
export interface DraggableLocation {
droppableId: DroppableId;
@@ -71,9 +69,33 @@ export class Droppable extends React.Component<DroppableProps> {}
* Draggable
*/
export type DraggableStyle = any;
export interface NotDraggingStyle {
transform: null | string;
transition: null | 'none';
}
export interface DragHandleProps {
export interface DraggingStyle {
pointerEvents: 'none';
position: 'fixed';
width: number;
height: number;
boxSizing: 'border-box';
top: number;
left: number;
margin: 0;
transform: null | string;
transition: 'none';
zIndex: ZIndex;
}
export interface DraggableProvidedDraggableProps {
// inline style
style: null | DraggingStyle | NotDraggingStyle;
// used for shared global styles
'data-react-beautiful-dnd-draggable': string;
}
export interface DraggableProvidedDragHandleProps {
onMouseDown: React.MouseEventHandler<any>;
onKeyDown: React.KeyboardEventHandler<any>;
onClick: React.MouseEventHandler<any>;
@@ -85,9 +107,11 @@ export interface DragHandleProps {
}
export interface DraggableProvided {
draggableProps: DraggableProvidedDraggableProps;
dragHandleProps: DraggableProvidedDragHandleProps | null;
// will be removed after move to react 16
innerRef(element?: HTMLElement | null): any;
draggableStyle?: DraggableStyle | null;
dragHandleProps?: DragHandleProps | null;
placeholder?: React.ReactElement<any> | null;
}
@@ -97,7 +121,7 @@ export interface DraggableStateSnapshot {
export interface DraggableProps {
draggableId: DroppableId;
type?: TypeId;
index: number;
isDragDisabled?: boolean;
disableInteractiveElementBlocking?: boolean;
children(provided: DraggableProvided, snapshot: DraggableStateSnapshot): React.ReactElement<any>;
@@ -24,7 +24,7 @@ const reorder = (list: any[], startIndex: number, endIndex: number) => {
return result;
};
const getItemStyle = (draggableStyle: any, isDragging: any) => ({
const getItemStyle = (isDragging: boolean, draggableStyle: any) => ({
userSelect: 'none',
background: isDragging ? 'lightgreen' : 'grey',
...draggableStyle
@@ -68,21 +68,16 @@ class App extends React.Component<{}, AppState> {
<DragDropContext onDragEnd={this.onDragEnd}>
<Droppable droppableId="droppable">
{(provided, snapshot) => (
<div
ref={provided.innerRef}
style={getListStyle(snapshot.isDraggingOver)}
>
{this.state.items.map(item => (
<Draggable key={item.id} draggableId={item.id} disableInteractiveElementBlocking={true}>
<div ref={provided.innerRef} style={getListStyle(snapshot.isDraggingOver)}>
{this.state.items.map((item, index) => (
<Draggable key={item.id} draggableId={item.id} index={index}>
{(provided, snapshot) => (
<div>
<div
ref={provided.innerRef}
style={getItemStyle(
provided.draggableStyle,
snapshot.isDragging
)}
{...provided.draggableProps}
{...provided.dragHandleProps}
style={getItemStyle(snapshot.isDragging, provided.draggableProps.style)}
>
{item.content}
</div>
+1 -1
View File
@@ -1,6 +1,6 @@
import { CSSModule } from '../index';
type InputType =
export type InputType =
| 'text'
| 'email'
| 'select'
+10
View File
@@ -15,6 +15,10 @@ import * as spdy from 'spdy';
import * as httpProxyMiddleware from 'http-proxy-middleware';
declare namespace WebpackDevServer {
interface ListeningApp {
address(): { port?: number };
}
interface proxyConfigMap {
[url: string]: string | httpProxyMiddleware.Config;
}
@@ -76,6 +80,12 @@ declare class WebpackDevServer {
config: WebpackDevServer.Configuration
);
static addDevServerEntrypoints(
webpackOptions: webpack.Configuration | webpack.Configuration[],
config: WebpackDevServer.Configuration,
listeningApp?: WebpackDevServer.ListeningApp
): void;
listen(port: number, hostname: string, callback?: (error?: Error) => void): http.Server;
listen(port: number, callback?: (error?: Error) => void): http.Server;
@@ -75,7 +75,7 @@ const config: WebpackDevServer.Configuration = {
// API example
server = new WebpackDevServer(compiler, config);
server.listen(8080, "localhost", () => {});
server.listen(8080, "localhost", () => { });
// HTTPS example
server = new WebpackDevServer(compiler, {
@@ -83,10 +83,25 @@ server = new WebpackDevServer(compiler, {
https: true
});
server.listen(8080, "localhost", () => {});
server.listen(8080, "localhost", () => { });
server.close();
// multiple compilers
WebpackDevServer.addDevServerEntrypoints(config, {
publicPath: "/assets/",
https: true
});
WebpackDevServer.addDevServerEntrypoints(
[config],
{
publicPath: "/assets/",
https: true
},
{
address: () => ({ port: 80 })
}
);
// multiple compilers
server = new WebpackDevServer(multipleCompiler, config);