mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-05 06:40:35 +08:00
Merge pull request #17224 from DefinitelyTyped/weak-type-errors-round-2
Fix primitive weak type errors
This commit is contained in:
@@ -15,7 +15,7 @@ class MapController {
|
||||
});
|
||||
|
||||
this.map = new Map({
|
||||
basemap: "topo"
|
||||
basemap: { title: "topo" }
|
||||
});
|
||||
|
||||
let view = new MapView({
|
||||
|
||||
@@ -175,7 +175,7 @@ authentication.buildAuthorizeUrl({
|
||||
connection_scope: 'scope1,scope2'
|
||||
});
|
||||
|
||||
authentication.buildLogoutUrl('asdfasdfds');
|
||||
authentication.buildLogoutUrl({ clientID: 'asdfasdfds' });
|
||||
authentication.buildLogoutUrl();
|
||||
authentication.userInfo('abcd1234', (err, data) => {
|
||||
//user info retrieved
|
||||
|
||||
@@ -82,7 +82,7 @@ var has = browserSync.has("My server");
|
||||
var bs = browserSync.create();
|
||||
|
||||
bs.init({
|
||||
server: "./app"
|
||||
server: { index: "./app" }
|
||||
});
|
||||
|
||||
bs.reload();
|
||||
|
||||
@@ -1343,7 +1343,7 @@ suite('assert', () => {
|
||||
assert.lengthOf([1, 2, 3], 3);
|
||||
assert.lengthOf('foobar', 6);
|
||||
assert.lengthOf('foobar', 5);
|
||||
assert.lengthOf(1, 5);
|
||||
assert.lengthOf({ length: 1 }, 5);
|
||||
});
|
||||
|
||||
test('match', () => {
|
||||
|
||||
3
types/chart.js/index.d.ts
vendored
3
types/chart.js/index.d.ts
vendored
@@ -261,6 +261,9 @@ declare namespace Chart {
|
||||
borderDash?: any[];
|
||||
borderDashOffset?: number;
|
||||
borderJoinStyle?: string;
|
||||
capBezierPoints?: boolean;
|
||||
fill?: 'zero' | 'top' | 'bottom' | boolean;
|
||||
stepped?: boolean;
|
||||
}
|
||||
|
||||
interface ChartPointOptions {
|
||||
|
||||
@@ -45,7 +45,7 @@ execa.shell('echo unicorns')
|
||||
{
|
||||
let result: string;
|
||||
result = execa.shellSync('foo').stderr;
|
||||
result = execa.shellSync('noop', ['foo']).stdout;
|
||||
result = execa.shellSync('noop', { cwd: 'foo' }).stdout;
|
||||
|
||||
result = execa.shellSync('foo').stderr;
|
||||
result = execa.shellSync('noop foo').stdout;
|
||||
|
||||
2
types/express-serve-static-core/index.d.ts
vendored
2
types/express-serve-static-core/index.d.ts
vendored
@@ -201,7 +201,7 @@ interface Request extends http.IncomingMessage, Express.Request {
|
||||
|
||||
header(name: string): string | undefined;
|
||||
|
||||
headers: { [key: string]: string | undefined; };
|
||||
headers: { [key: string]: string | string[]; };
|
||||
|
||||
/**
|
||||
* Check if the given `type(s)` is acceptable, returning
|
||||
|
||||
@@ -46,7 +46,7 @@ var id: string = instance.addItem("Test2");
|
||||
var item: ListboxItem = <ListboxItem>{};
|
||||
item.selected = true;
|
||||
item.disabled = false;
|
||||
item.childItems = ["Test4"];
|
||||
item.childItems = [{ text: "Test4" }];
|
||||
item.groupHeader = false;
|
||||
item.id = "ouetioreit";
|
||||
item.index = 0;
|
||||
|
||||
@@ -547,7 +547,7 @@ function sample8() {
|
||||
if (!fabric.Canvas.supports('toDataURL')) {
|
||||
alert('This browser doesn\'t provide means to serialize canvas to an image');
|
||||
} else {
|
||||
window.open(canvas.toDataURL('png'));
|
||||
window.open(canvas.toDataURL({ format: 'png' }));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -13,7 +13,10 @@ fbq('track', 'Purchase', purchaseParam);
|
||||
|
||||
// Custom event (can only be used for audience building)
|
||||
|
||||
var custom_params = {custom_param: 'custom_value'};
|
||||
var custom_params = {
|
||||
custom_param: 'custom_value',
|
||||
content_type: 'product'
|
||||
};
|
||||
fbq('trackCustom', 'MyCustomEvent', custom_params);
|
||||
|
||||
// Reach customers that viewed a product in the 'Shoes' category
|
||||
|
||||
@@ -75,10 +75,10 @@ $(window).load(function() {
|
||||
function ready(player_id: any) {
|
||||
var froogaloop = $(player_id);
|
||||
froogaloop.on('play', function(data) {
|
||||
$('.flexslider').flexslider("pause");
|
||||
$('.flexslider').flexslider({ pauseText: "pause" });
|
||||
});
|
||||
froogaloop.on('pause', function(data) {
|
||||
$('.flexslider').flexslider("play");
|
||||
$('.flexslider').flexslider({ playText: "play" });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ import * as ImportUsingES6Syntax from 'form-data';
|
||||
() => {
|
||||
var form = new FormData();
|
||||
|
||||
http.request('http://nodejs.org/images/logo.png', function (response) {
|
||||
http.request({ path: 'http://nodejs.org/images/logo.png' }, function (response) {
|
||||
form.append('my_field', 'my value');
|
||||
form.append('my_buffer', new Buffer(10));
|
||||
form.append('my_logo', response);
|
||||
|
||||
@@ -35,5 +35,5 @@ gulp.task('lint', shell.task('eslint ' + paths.js.join(' ')));
|
||||
gulp.task('default', gulp.parallel('coverage', 'lint'));
|
||||
|
||||
gulp.task('watch', function () {
|
||||
gulp.watch(paths.js, ['default'])
|
||||
gulp.watch(paths.js)
|
||||
});
|
||||
|
||||
4
types/hapi/index.d.ts
vendored
4
types/hapi/index.d.ts
vendored
@@ -678,6 +678,10 @@ export interface CatboxServerCacheConfiguration extends Catbox.PolicyOptions {
|
||||
* [See docs](https://hapijs.com/api/16.1.1#servercacheprovisionoptions-callback) example code includes use of `name` option. But server.cache.provision of `options` says "same as the server cache configuration options.".
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* Additional options to be passed to the Catbox strategy
|
||||
*/
|
||||
[s: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,7 @@ let config: Hapi.RouteAdditionalConfigurationOptions = {
|
||||
},
|
||||
};
|
||||
|
||||
interface CustomValidationOptions {
|
||||
interface CustomValidationOptions extends Joi.ValidationOptions {
|
||||
myOption: number;
|
||||
}
|
||||
|
||||
|
||||
2
types/heredatalens/index.d.ts
vendored
2
types/heredatalens/index.d.ts
vendored
@@ -181,7 +181,7 @@ declare namespace H {
|
||||
* @param service {H.datalens.Service} - Data Lens REST API service
|
||||
* @param options {H.datalens.QueryProvider.Options=} - Configures source query and data accessibility parameters
|
||||
*/
|
||||
constructor(data: H.datalens.Service.Data, options?: H.map.provider.Provider.Options);
|
||||
constructor(data: H.datalens.Service.Data, options?: H.datalens.QueryProvider.Options);
|
||||
|
||||
/**
|
||||
* Updates the query ID to be used in the next call of the Data Lens REST API.
|
||||
|
||||
2
types/heremaps/index.d.ts
vendored
2
types/heremaps/index.d.ts
vendored
@@ -4556,7 +4556,7 @@ declare namespace H {
|
||||
normal?: H.service.MapType;
|
||||
satellite?: H.service.MapType;
|
||||
terrain?: H.service.MapType;
|
||||
[key: string]: H.service.MapType;
|
||||
[key: string]: H.service.MapType | undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ function test_pnotify() {
|
||||
text: 'I don\'t have a shadow. (It\'s cause I\'m a vampire or something. Or is that reflections...)',
|
||||
shadow: false
|
||||
});
|
||||
new PNotify('Check me out! I\'m a notice.');
|
||||
// new PNotify('Check me out! I\'m a notice.');
|
||||
|
||||
new PNotify(Math.round(Math.random() * 9999));
|
||||
// new PNotify(Math.round(Math.random() * 9999));
|
||||
|
||||
new PNotify({
|
||||
title: 'PIcon Notice',
|
||||
@@ -216,7 +216,7 @@ function test_pnotify() {
|
||||
icon: "fa fa-bars",
|
||||
delay: 20000,
|
||||
history: false,
|
||||
stack: false
|
||||
stack: {}
|
||||
});
|
||||
|
||||
var type = "error";
|
||||
|
||||
@@ -22,8 +22,8 @@ $(function() {
|
||||
$('#focus-example [title]').tipsy({trigger: 'focus', gravity: 'w'});
|
||||
});
|
||||
|
||||
function onclickExample1() { $("#manual-example a[rel=tipsy]").tipsy("show"); return false; }
|
||||
function onclickExample2() { $("#manual-example a[rel=tipsy]").tipsy("hide"); return false; }
|
||||
function onclickExample1() { $("#manual-example a[rel=tipsy]").tipsy({ title: "show" }); return false; }
|
||||
function onclickExample2() { $("#manual-example a[rel=tipsy]").tipsy({ title: "hide" }); return false; }
|
||||
$('#manual-example a[rel=tipsy]').tipsy({trigger: 'manual'});
|
||||
|
||||
$('a.live-tipsy').tipsy({live: true});
|
||||
$('a.live-tipsy').tipsy({live: true});
|
||||
|
||||
1
types/jqueryui/index.d.ts
vendored
1
types/jqueryui/index.d.ts
vendored
@@ -1804,6 +1804,7 @@ interface JQuery {
|
||||
tabs(methodName: 'load', index: number): void;
|
||||
tabs(methodName: 'refresh'): void;
|
||||
tabs(methodName: 'widget'): JQuery;
|
||||
tabs(methodName: 'select', index: number): JQuery;
|
||||
tabs(methodName: string): JQuery;
|
||||
tabs(options: JQueryUI.TabsOptions): JQuery;
|
||||
tabs(optionLiteral: string, optionName: string): any;
|
||||
|
||||
1
types/knockout/index.d.ts
vendored
1
types/knockout/index.d.ts
vendored
@@ -154,6 +154,7 @@ interface KnockoutBindingHandler {
|
||||
update?: (element: any, valueAccessor: () => any, allBindingsAccessor?: KnockoutAllBindingsAccessor, viewModel?: any, bindingContext?: KnockoutBindingContext) => void;
|
||||
options?: any;
|
||||
preprocess?: (value: string, name: string, addBindingCallback?: (name: string, value: string) => void) => string;
|
||||
[s: string]: any;
|
||||
}
|
||||
|
||||
interface KnockoutBindingHandlers {
|
||||
|
||||
@@ -981,7 +981,7 @@ namespace http_tests {
|
||||
}
|
||||
|
||||
{
|
||||
var request = http.request('http://0.0.0.0');
|
||||
var request = http.request({ path: 'http://0.0.0.0' });
|
||||
request.once('error', function() { });
|
||||
request.setNoDelay(true);
|
||||
request.abort();
|
||||
|
||||
4
types/ramda/index.d.ts
vendored
4
types/ramda/index.d.ts
vendored
@@ -202,8 +202,8 @@ declare namespace R {
|
||||
* A function that returns the first argument if it's falsy otherwise the second argument. Note that this is
|
||||
* NOT short-circuited, meaning that if expressions are passed they are both evaluated.
|
||||
*/
|
||||
and<T extends {and?: Function;}>(fn1: T, val2: boolean|any): boolean;
|
||||
and<T extends {and?: Function;}>(fn1: T): (val2: boolean|any) => boolean;
|
||||
and<T extends {and?: Function;} | number | boolean | string>(fn1: T, val2: boolean|any): boolean;
|
||||
and<T extends {and?: Function;} | number | boolean | string>(fn1: T): (val2: boolean|any) => boolean;
|
||||
|
||||
/**
|
||||
* Returns true if at least one of elements of the list match the predicate, false otherwise.
|
||||
|
||||
2
types/randomstring/index.d.ts
vendored
2
types/randomstring/index.d.ts
vendored
@@ -11,7 +11,7 @@ declare namespace Randomstring {
|
||||
capitalization?: string;
|
||||
}
|
||||
|
||||
function generate(options?: GenerateOptions): string;
|
||||
function generate(options?: GenerateOptions | number): string;
|
||||
}
|
||||
|
||||
declare module "randomstring" {
|
||||
|
||||
2
types/react-addons-update/index.d.ts
vendored
2
types/react-addons-update/index.d.ts
vendored
@@ -19,7 +19,7 @@ declare module 'react' {
|
||||
[key: string]: UpdateSpec;
|
||||
}
|
||||
|
||||
type UpdateSpec = UpdateSpecCommand | UpdateSpecPath;
|
||||
type UpdateSpec = number[][] | UpdateSpecCommand | UpdateSpecPath;
|
||||
|
||||
interface UpdateArraySpec extends UpdateSpecCommand {
|
||||
$push?: any[];
|
||||
|
||||
@@ -13,7 +13,7 @@ const initialRouterEntries = [
|
||||
];
|
||||
|
||||
const MemoryRouterExample = () => (
|
||||
<MemoryRouter initialEntries={[initialRouterEntries]} initialIndex={1}>
|
||||
<MemoryRouter initialEntries={initialRouterEntries} initialIndex={1}>
|
||||
<div>
|
||||
<ul>
|
||||
<li><Link to="/">Home</Link></li>
|
||||
|
||||
@@ -11,7 +11,7 @@ import TestUtils = require("react-addons-test-utils");
|
||||
import TransitionGroup = require("react-addons-transition-group");
|
||||
import update = require("react-addons-update");
|
||||
|
||||
interface Props {
|
||||
interface Props extends React.Attributes {
|
||||
hello: string;
|
||||
world?: string;
|
||||
foo: number;
|
||||
|
||||
@@ -8,7 +8,7 @@ function nodeJS(session: autobahn.Session) {
|
||||
}
|
||||
|
||||
function connection() {
|
||||
var connectionSubscription = Rx.Observable.fromConnection("ws://localhost:9000")
|
||||
var connectionSubscription = Rx.Observable.fromConnection({ url: "ws://localhost:9000" })
|
||||
.subscribe(session => console.log("A new session was created"));
|
||||
|
||||
//Close our current connection and don't retry
|
||||
@@ -32,11 +32,11 @@ function subscribe_to_topics(session: autobahn.Session, options: autobahn.ISubsc
|
||||
}
|
||||
|
||||
function new_in_version3(onResult: Rx.Observer<autobahn.ISubscription>) {
|
||||
Rx.Observable.subscribeAsObservable(Rx.Observable.fromConnection("ws://myconnectionurl:9090"), "wamp.my.foo", undefined, onResult);
|
||||
Rx.Observable.subscribeAsObservable(Rx.Observable.fromConnection({ url: "ws://myconnectionurl:9090" }), "wamp.my.foo", undefined, onResult);
|
||||
}
|
||||
|
||||
function new_in_version5(fooObserver: Rx.Observer<IWampEvent>) {
|
||||
var connection = Rx.Observable.fromConnection("ws://myconnectionurl:9090");
|
||||
var connection = Rx.Observable.fromConnection({ url: "ws://myconnectionurl:9090" });
|
||||
|
||||
//You can subscribe to as many items as you want
|
||||
var subscriber =
|
||||
|
||||
@@ -34,7 +34,7 @@ var eventsListener = (e:any)=> {
|
||||
}
|
||||
|
||||
function createSipStack(){
|
||||
sipStack = new SIPml.Stack('blaat');
|
||||
sipStack = new SIPml.Stack({ display_name: 'blaat' });
|
||||
sipStack = new SIPml.Stack({
|
||||
realm: 'example.org', // mandatory: domain name
|
||||
impi: 'bob', // mandatory: authorization name (IMS Private Identity)
|
||||
|
||||
2
types/svg-sprite/index.d.ts
vendored
2
types/svg-sprite/index.d.ts
vendored
@@ -243,7 +243,7 @@ declare namespace sprite {
|
||||
defs?: DefsAndSymbolSpecificModeConfig | boolean;
|
||||
symbol?: DefsAndSymbolSpecificModeConfig | boolean;
|
||||
stack?: ModeConfig | boolean;
|
||||
[customConfigName: string]: ModeConfig;
|
||||
[customConfigName: string]: ModeConfig | boolean;
|
||||
}
|
||||
|
||||
interface ModeConfig {
|
||||
|
||||
@@ -27,7 +27,7 @@ webpackDevMiddlewareInstance = webpackDevMiddleware(compiler, {
|
||||
});
|
||||
|
||||
const app = express();
|
||||
app.use(webpackDevMiddlewareInstance);
|
||||
app.use([webpackDevMiddlewareInstance]);
|
||||
|
||||
webpackDevMiddlewareInstance.close();
|
||||
webpackDevMiddlewareInstance.invalidate();
|
||||
|
||||
12
types/zeroclipboard/index.d.ts
vendored
12
types/zeroclipboard/index.d.ts
vendored
@@ -330,13 +330,13 @@ declare namespace ZC {
|
||||
* @param {string} eventType
|
||||
* @param {EventListener<ZeroClipboardEvent>} listener
|
||||
*/
|
||||
off(eventType: string, listener: EventListenerOrEventListenerObject<ZeroClipboardEvent>): void;
|
||||
off(eventType: "ready", listener: EventListenerOrEventListenerObject<ZeroClipboardReadyEvent>): void;
|
||||
off(eventType: "beforecopy", listener: EventListenerOrEventListenerObject<ZeroClipboardBeforeCopyEvent>): void;
|
||||
off(eventType: "copy", listener: EventListenerOrEventListenerObject<ZeroClipboardCopyEvent>): void;
|
||||
off(eventType: "aftercopy", listener: EventListenerOrEventListenerObject<ZeroClipboardAfterCopyEvent>): void;
|
||||
off(eventType: "destroy", listener: EventListenerOrEventListenerObject<ZeroClipboardDestroyEvent>): void;
|
||||
off(eventType: "error", listener: EventListenerOrEventListenerObject<ZeroClipboardErrorEvent>): void;
|
||||
off(eventType: string, listener: EventListenerOrEventListenerObject<ZeroClipboardEvent>): void;
|
||||
/**
|
||||
* Remove a set of eventType to listener function/object mappings.
|
||||
* @param {EventListener<ZeroClipboardErrorEvent>} listenerObj
|
||||
@@ -349,6 +349,16 @@ declare namespace ZC {
|
||||
destroy?: EventListenerOrEventListenerObject<ZeroClipboardDestroyEvent>;
|
||||
error?: EventListenerOrEventListenerObject<ZeroClipboardErrorEvent>;
|
||||
}): void;
|
||||
/**
|
||||
* Remove a set of eventType to listener function/object mappings.
|
||||
*/
|
||||
off(eventType: "ready"): void;
|
||||
off(eventType: "beforecopy"): void;
|
||||
off(eventType: "copy"): void;
|
||||
off(eventType: "aftercopy"): void;
|
||||
off(eventType: "destroy"): void;
|
||||
off(eventType: "error"): void;
|
||||
off(eventType: string): void;
|
||||
/**
|
||||
* Remove ALL listener functions/objects for ALL registered event types.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user