question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing Typescript declarations for next-slicezone

See original GitHub issue

Version

v3.8.4

Reproduction

  • install next-slicezone in a Typescript project.
  • import hooks.

What is expected?

  • A TypeScript definition is found for all importable modules.

What is actually happening?

  • The TypeScript compilator complains (and refuses to compile).

Any additional information

Auto-generated declarations should probably cover most needs. https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
beqramocommented, Oct 26, 2021

any fix? that library needs type declaration file

6reactions
jamschcommented, Jul 20, 2021

Yep, you’d want to do something like the following for the time being

declare module "next-slicezone";
declare module "next-slicezone/hooks";
declare module "next-slicezone/resolver";

Also, to avoid the eslint error react-hooks/rules-of-hooks you’d want to alias the “useXXX” exports

// pages/[uid].tsx

import {
  useGetStaticProps as createGetStaticProps,
  useGetStaticPaths as createGetStaticPaths,
} from "next-slicezone/hooks";
// ...
export const getStaticProps = createGetStaticProps({ ... });
export const getStaticPaths = createGetStaticPaths({ ... });
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to type new prismic SliceZone components
I wanted to replace the next/slicezone with the new slicezone. But I ran into TypeScript problems. All my slice components are typed like...
Read more >
Missing typescript declaration file in javascript - Stack Overflow
My project is mixed javascript and typescript files. That's my tsconfig.json file: "compilerOptions": { "target": "es2017", "baseUrl": ".
Read more >
@prismicio/react | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
next-slicezone - npm
Next SliceZone. A component that fetches Prismic files, returns slices found and matches them with front-end components.
Read more >
GEOM User Guide - LLNL - Nuclear Data
All base names may cg be displayed with command "last". cg The next name after or ... See a math or geometry handbook...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found