Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Demo app typescript errors #47

Open
nite opened this issue Jan 26, 2020 · 5 comments
Open

Demo app typescript errors #47

nite opened this issue Jan 26, 2020 · 5 comments

Comments

@nite
Copy link

nite commented Jan 26, 2020

Hi,

Spinning up your demo app, firstly I get this:

/src/App.tsx
TypeScript error in /Users/andyc/dev/openfin/openfin-react-hooks/demo/src/App.tsx(76,27):
Expected 2 type arguments, but got 1.  TS2558

    74 | };
    75 | 
  > 76 | export default withRouter<RouteComponentProps>(App);

fixed with: export default withRouter(App);

Now, I'm blocked by:

/src/pages/bounds/Bounds.tsx(44,11):
Type 'Bounds' is not an array type.  TS2461

    42 | 
    43 | const Bounds: React.FC = () => {
  > 44 |     const [bounds, setBounds] = useBounds();

any ideas?

typescript version:

yarn list typescript
yarn list v1.7.0
warning Filtering by arguments is deprecated. Please use the pattern option instead.
└─ [email protected]
@nite nite changed the title Demo typescript errors Demo app typescript errors Jan 26, 2020
@oriondean
Copy link
Contributor

Hi, thanks for reporting this.

For the typing issue, did you happen to install the demo dependencies via npm not yarn?
We've seen an issue where @types/react-router-dom v5.1.3 has been installed when the package-lock.json` stipulates that v.5.0.0 should be installed. If you install via yarn, that lockfile is ignored, we should probably tie that dependency down.

From the looks of the second typing issue, it seems like your TSC/IDE is still using the old useBound typings, does the index.d.ts file in the root of the repo directory show useBounds returning an array type on line 70?

@nite
Copy link
Author

nite commented Jan 30, 2020

Sorry for delay on this - I've installed with npm now, however I'm getting this:

./src/pages/bounds/Bounds.tsx
Module not found: Can't resolve 'openfin-react-hooks' in '/home/andyc/work/bmll/tmp/openfin-react-hooks/demo/src/pages/bounds'

I've re-run npm i openfin-react-hooks -D for good measure.

Typing looks good on useBound now:

export const useBounds: (target?: _Window) => [
    Bounds | undefined,
    (newBounds: Bounds) => Promise<void>
];

@nite
Copy link
Author

nite commented Jan 30, 2020

Switching back to node 12 (from 13) & got the app running. I've run it with npm start in 1 terminal & npm run launch in another.
Now, if I click on anything, I get a white screen - cant load devtools, app just crashes. Nothing running on localhost:9090.
Worth mentioning, I get this on npm run launch:

using config /Users/andyc/dev/openfin/openfin-react-hooks/demo/public/app.dev.json
Error: Failed to load url: https://app-directory.openfin.co/api/v1/apps/layouts, status code:404

I have a single openfin-react-hook running now in starter-typescript-react-sass, so hopefully I'm underway with kicking the tyres a bit more in the meantime.

@oriondean
Copy link
Contributor

Not seen that layouts 404 issue before, might be something up with openfin, do you still see it?

With regards to the cannot resolve openfin-react-hooks, you may need to run a npm run compile in the root directory to do a first-time compile of the hooks before using them.

@Lonli-Lokli
Copy link

Lonli-Lokli commented Feb 28, 2022

Node v14.18.2
npm 6.14.15

PS D:\github\openfin-react-hooks> npm run compile

> [email protected] compile D:\github\openfin-react-hooks
> tsc

../node_modules/@types/prettier/index.d.ts:537:14 - error TS2456: Type alias 'Doc' circularly references itself.

537         type Doc = string | Doc[] | DocCommand;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants