Loadable-components: Out of date docs or incorrect types?

Created on 11 Feb 2019  路  8Comments  路  Source: gregberge/loadable-components

馃悰 Bug Report

When using typescript there are two issues. Once when using the syntax from the prefetching docs: https://www.smooth-code.com/open-source/loadable-components/docs/prefetching/ and the other when trying to preload.

To Reproduce

// Argument of type '() => string' is not assignable to parameter of type '(props: {}) => Promise<DefaultComponent<{}>>'.
// Type 'string' is not assignable to type 'Promise<DefaultComponent<{}>>'.
export const User = () => loadable(() => './User')

and

export const User = () => loadable(() => import('./User'))

// Property 'preload' does not exist on type '() => ComponentType<{ fallback?: Element | undefined; }>'.
User.preload()

Expected behavior

Typescript should not error and docs should be updated

Details


## System:
 - OS: Linux 4.4 Ubuntu 16.04.2 LTS (Xenial Xerus)
 - CPU: (16) x64 AMD Ryzen 7 1700X Eight-Core Processor
 - Memory: 8.81 GB / 15.95 GB
 - Shell: 4.3.46 - /bin/bash
## Binaries:
 - Node: 10.15.0 - ~/.nvm/versions/node/v10.15.0/bin/node
 - Yarn: 1.9.4 - ~/.yarn/bin/yarn
 - npm: 6.4.1 - ~/.nvm/versions/node/v10.15.0/bin/npm

good first issue 馃 help wanted 馃啒 typings 馃敡

Most helpful comment

:working:

All 8 comments

Hello @bitttttten, thanks for your report.

Help is needed here, could someone please update TypeScript types ? Thanks!

@theKashey I guess?

:working:

Ah I didn't realise the preload method was reasonably new too. I was actually on 5.5.0 at the time.

That's quite strange, but there are type definitions?
Nor here, nor in DefinitelyTypes. All I found is https://github.com/DefinitelyTyped/DefinitelyTyped/tree/f37d7b008ce2c4ecbbbc4bee009fb3f03d639268/types/loadable__component, which is for older versions.

There are type definitions but they have not been updated since the release that was 2 weeks ago.

@bitttttten - so where is that there

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gregberge picture gregberge  路  6Comments

mschipperheyn picture mschipperheyn  路  5Comments

valorloff picture valorloff  路  3Comments

kronosfere picture kronosfere  路  5Comments

lauterry picture lauterry  路  6Comments