Commit Graph
55441 Commits
Author SHA1 Message Date
Alex Jerabek d9068c9d4e Correcting RangeFill description (#31815) 2018-12-31 11:31:10 -08:00
Dimitri Benin a1a6a81974 [typpy] Add types (#31804) 2018-12-31 11:04:17 -08:00
Dimitri Benin 8492d9a89b [@keyv/redis] Add types (#31809) 2018-12-31 10:55:20 -08:00
Dimitri Benin 56f95b3526 [@keyv/postgres] Add types (#31808) 2018-12-31 10:53:51 -08:00
Dimitri Benin 6fd150e951 [@keyv/mongo] Add types (#31806) 2018-12-31 10:51:27 -08:00
TeamworkGuy2 ae36dd3474 [readable-stream] Add readable-stream@2.3.6 definition (#31805) 2018-12-31 10:50:31 -08:00
Dimitri Benin 44edbc65ed [boxen] Add types (#31812) 2018-12-31 10:48:38 -08:00
Oliver Joseph Ash a0f4fe7299 react-helmet: add link and meta prop types (#31802)
* Add missing semicolon

* Add link and meta prop types
2018-12-31 10:43:36 -08:00
Anton Astashov b081a5b7d0 [@types/koa]: Parameterize Context and Application. (#31704)
* [@types/koa]: Parameterize `Context` and `Application`.

Currently, `ctx.state` is `any`, and `ctx` itself allows any fields to
be inside `Context`. That's essentially 2 places where developers can
add their custom properties, and would be great to opt-in into more
typesafe approach than it's currently is.

What if we parameterize `Context` and `Application` with 2 types - one
will define `ctx.state`, and another - fields in `Context`? Then, if you
chain `use`, TypeScript will infer the types properly for your
middlewares. Like:

```typescript
interface NewContext {
  orgh: string;
}

interface FooState {
  foo: string;
}

interface BarState {
  bar: string;
}

async function fooMiddleware(
  ctx: Koa.Context<FooState>,
  next: () => Promise<void>
): Promise<void> {
  ctx.state.foo = "foo";
  await next();
}

async function barMiddleware(
  ctx: Koa.Context<BarState>,
  next: () => Promise<void>
): Promise<void> {
  ctx.state.bar = "bar";
  await next();
}

const app = new Koa<{}, {}>()
  .use(fooMiddleware)
  .use(barMiddleware)
  .use<{}, NewContext>(async (ctx, next) => {
    // Here ctx is inferred as Koa.Context<FooState & BarState, NewContext>
    ctx.orgh = "bazinga";
    await next();
  })
  .use(async (ctx, next) => {
    // Here ctx is inferred as Koa.Context<FooState & BarState, NewContext>
    await next();
  });
// `app` here is `Koa<FooState & BarState, NewContext>`

app.listen(3000);
```

So, if you define `const app = new Koa<{}, {}>()`, then you'll opt-in
into "typesafe" Koa Context. But if you do just `const app = new Koa()`,
you still will have `ctx.state: any`, like before. So, it should be
backwards-compatible.

But even in this case you can specify what the `ctx` is inside
the middlewares, like:

```typescript
const app2 = new Koa();
app2.use(fooMiddleware);
app2.use(async (ctx, next) => {
  // `ctx.state` here is inferred as `any`
  ctx.state.prop = "Some Prop";
  await next();
});
app2.use(async (ctx: Koa.Context<{}, NewContext>, next) => {
  ctx.orgh = "oh yeah";
  await next();
});
app2.use(async (ctx: Koa.Context<FooState>, next) => {
  ctx.state.foo = "Yay";
  await next();
});
```

What do you think?

* Rename new `Context` to `ParameterizedContext`

So that all the old hacks with declaration merging of Koa's `Context`
wouldn't break.

* Fix the build

* Use Context instead of ParameterizedContext when possible
2018-12-31 10:35:34 -08:00
David Gomes 6b9f1df1d2 Fix type of Redux Form event handlers. (#31607)
* Fix type of Redux Form event handlers.

* Rename `fieldName` to `name` to keep flow type definitions consistent with Redux Form naming.

Co-Authored-By: davidgomes <davidrafagomes@gmail.com>

* Adds the missing name parameter to the onFocus and onDragStart event handlers in redux-form.

https://redux-form.com/7.4.2/docs/api/field.md/#-code-onblur-event-newvalue-previousvalue-name-gt-void-code-optional-

https://redux-form.com/7.4.2/docs/api/field.md/#-code-ondragstart-event-name-gt-void-code-optional-

Co-Authored-By: davidgomes <davidrafagomes@gmail.com>

* Removes weird space I added accidentally.
2018-12-31 10:33:29 -08:00
Marco Lanaro 2d5bc81771 Add types for distributions (#31472)
* Add types for distributions

* Fix import
2018-12-31 10:29:48 -08:00
Robert Bullen 1683b160b9 yup: ObjectSchema.shape() should support type intersections (#31290)
* - change ObjectSchema<T>.shape() to ObjectSchema<T>.shape<U>()
- changed Schema.validate*() to accept any type
- made declaration of Ref more restrictive
- bumped definitions version

* Addressed PR feedback:
- refined `ObjectSchema.shape()` with `Shape<T, U>`
- added a few more test cases
2018-12-31 10:23:59 -08:00
Mihail Novikov 499c5aaf02 Add types for react-simple-maps (#31221)
* Add types for react-simple-maps

* [@types/react-simple-maps] Add test file
2018-12-31 10:22:13 -08:00
Youngrok Kim 8acdd28c1e [range-parser] replace const enum with plain enum (#30680)
* description

* --isolatedModules fix

* replace const enum with plain enum
2018-12-31 10:17:47 -08:00
Joshua Searles d8efd10d1a Update Autobahn Connection with properties isRetrying and session (#30526)
* Update Autobahn Connection with properties isRetrying and session

* Adjust dtheader, per review
2018-12-31 10:15:15 -08:00
Oscar Busk 9272fc1637 [d3-cloud] Support import syntax (#30479)
* Allow importing from `d3-cloud`

* Modify export to be CommonJS
2018-12-31 10:13:42 -08:00
Shai Reznik 6d9584582e [jasmine-given] add fail function to done function definition (#29933) 2018-12-31 10:06:27 -08:00
Erik Kristensen 703965fef5 [@types/restify] Fix Callback Typing on Restify Metrics Plugin (#29785)
* fix typing on restify metrics plugin

* should be a function with typed arguments

* adding some comments to get another build to move the PR along
2018-12-31 10:03:22 -08:00
Laurens Rietveld 3095a0a266 N3: Added typings for synchronous parsing (#29726)
* N3: Added typings for synchronous parsing

* Improved signature order of parse function
2018-12-31 10:00:12 -08:00
Stephan Troyer 022a46ef5a react-youtube: refactor interfaces (#31699)
* separate interfaces

* fix linting
2018-12-31 09:03:26 -08:00
dominikeinkemmer 442fcd1ffd add support for chained calls in typings (#31695) 2018-12-31 09:02:59 -08:00
Dimitri Benin e8cd4c9394 [nedb] Nedb class should extend EventEmitter (#31669) 2018-12-31 09:02:12 -08:00
Dimitri Benin 9e661f99a8 [keyv] Extend types (#31671) 2018-12-31 09:01:46 -08:00
Dobes Vandermeer 3e51ab5038 Change constructEvent to return IEvent (#31655)
StripeWebhookEvent is redundant, as its contents are meant to be exactly
the contents of IEvent.
2018-12-31 09:01:09 -08:00
Dimitri Benin 70eea52fa7 [rc] Improve types (#31645) 2018-12-31 09:00:24 -08:00
Dimitri Benin eeb54c4e39 [ip] Improve types (#31641) 2018-12-31 08:59:46 -08:00
Emre d4bc37efcf flickity slider asNavFor property fix (#31633)
flickity slider's definition for `asNavFor` property may be string *or* HTMLElement proper to its documentation.
Please take a look at https://flickity.metafizzy.co/options.html#asnavfor for further information
2018-12-31 08:59:14 -08:00
Dimitar Dimitrov ece03cde44 Bugfix for SlateJs Path type (#31627)
`Path` should accept a number as well, for example `.moveTo(5)` should be accepted as indicated in the documentation and source code of Slate (internally it will default to an offset).

https://github.com/ianstormtaylor/slate/blob/7192a97600a9e26e5b9156657a0de193431f3001/packages/slate/src/models/point.js#L299-L314
2018-12-31 08:58:55 -08:00
Agustín Carrasco 01439b1d39 [moment-timezone] setDefault() can be called without arguments (#31625)
Reference: https://momentjs.com/timezone/docs/#/using-timezones/default-timezone/
2018-12-31 08:58:31 -08:00
David Wandar fec917b4b9 Heatmap addition (#31602)
added heatmap placeholder
2018-12-31 08:52:55 -08:00
Hyunyoung Cho 0f18f42a4d Add types for react-headroom (#31697)
* Add: react-headroom types

* Fix: dt-headers
2018-12-31 08:50:42 -08:00
Arthur Zagorsky 5737da0af9 [ramda] add placeholders overloads (#31719) 2018-12-31 08:47:36 -08:00
Alexander Sychev 052b473238 Types for "micro-events" package (#31718)
* Types for "micro-events" package

* Fix version of TS by travis error
2018-12-31 08:46:27 -08:00
Riku Kallio eca1d0fcdb Added types for react-rangeslider package (#31721)
* Added types for react-rangeslider

* Fixed rangeslider types to pass tests

* Changed spaces to tabs
2018-12-31 08:45:58 -08:00
MattiasMartens cdd6ada582 Type definition for the library 'regression' (#31728)
* Type definition for the library 'regression'

* Fix to match the commonJS style used by the real library
2018-12-31 08:44:53 -08:00
Dimitri Benin 5ab05e7f2d [buffer-crc32] Add types (#31727) 2018-12-31 08:44:29 -08:00
Dimitri Benin 992866cea7 [is-plain-obj] Add types (#31730) 2018-12-31 08:44:12 -08:00
Omer Yalhi 51474e1b4f Added type definitions for smart-truncate (#31743) 2018-12-31 08:36:18 -08:00
Dimitri Benin e193757d8e [one-time] Add types (#31747) 2018-12-31 08:33:41 -08:00
Netto Farah 524badb2af Add defintions for ui-box@1.4 (#31750)
📦 ui-box is a low level CSS-in-JS solution that focuses on being simple,
fast and extensible. All CSS properties are set using simple React props,
which allows you to easily create reusable components that can be enhanced
with additional CSS properties.

https://github.com/segmentio/ui-box
2018-12-31 08:33:16 -08:00
Dimitri Benin 1edbe22747 [parse-passwd] Add types (#31751) 2018-12-31 08:32:14 -08:00
jlismore b3e3580a66 [trie-prefix-tree] Add types for trie-prefix-tree (#31754)
* Add types for trie-prefix-tree

* Add TS version
2018-12-31 08:30:09 -08:00
Dimitri Benin f796b740d0 [istextorbinary] Add types (#31758) 2018-12-31 08:26:46 -08:00
Dimitri Benin 91034ca243 [textextensions] Add types (#31760) 2018-12-31 08:24:10 -08:00
Dimitri Benin 4ae2869a19 [binaryextensions] Add types (#31759) 2018-12-31 08:23:48 -08:00
Dimitri Benin 548be48465 [strip-color] Add types (#31764) 2018-12-31 08:23:28 -08:00
Dimitri Benin 329bd4c233 [saslprep] Add types (#31766) 2018-12-31 08:22:39 -08:00
Dimitri Benin b5e2917c01 [shallowequal] Update types to v1.1 (#31765)
* [shallowequal] Move v0 type to sub-dir

* [shallowequal] Update types to v1.1
2018-12-31 08:21:58 -08:00
Dimitri Benin 992612e192 [symlink-or-copy] Add types (#31770) 2018-12-31 08:19:40 -08:00
Dimitri Benin c167f72bce [cli-boxes] Add types (#31771) 2018-12-31 08:19:20 -08:00