Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.1.2 back-compat: Type error: Module '"sanity"' has no exported member 'Block'. #4027

Closed
ShaneMcX opened this issue Dec 28, 2022 · 3 comments

Comments

@ShaneMcX
Copy link

If you find a security vulnerability, do NOT open an issue. Email security@sanity.io instead.

Describe the bug
Showcase template build is broken when upgrading from 3.0.6 to 3.1.2.

Type error: Module '"sanity"' has no exported member 'Block'.

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://www.sanity.io/templates/personal-website-with-built-in-content-editing or https://github.com/sanity-io/template-nextjs-personal-website
  2. Follow instructions to get a local build set up
  3. npm run build
  4. See that it succeeds (npm i installed sanity 3.0.6)

Repro option 1:
6. yarn (automatically updates to sanity 3.1.2)
7. yarn build or npm run build
8. See error:

info  - Linting and checking validity of types ..Failed to compile.

./components/global/Footer.tsx:2:10
Type error: Module '"sanity"' has no exported member 'Block'.

  1 | import { CustomPortableText } from 'components/shared/CustomPortableText'
> 2 | import { Block } from 'sanity'
    |          ^
  3 |
  4 | export function Footer({ footer }: { footer: Block[] }) {
  5 |   return (

Option 2:
5. Edit package.json to update sanity to 3.1.2
6. yarn build or npm run build
7. See same error as above.

Expected behavior

Build should succeed as 3.1.2 should be backwards-compatible with 3.0.6, or at least required changes should be documented clearly.

Screenshots
N/A

Which versions of Sanity are you using?

see above for versions in build

@sanity/cli 2.35.0 (latest: 3.1.2)
@sanity/demo 1.0.1 (up to date)
@sanity/image-url 1.0.1 (up to date)
@sanity/vision 3.0.2 (latest: 3.1.2)

What operating system are you using?

MacOS 13.1

Which versions of Node.js / npm are you running?

Run npm -v && node -v in the terminal and copy-paste the result here.

8.19.2
v18.12.1

Additional context

Issue reported on template git site

Security issue?

No.

Any security issues should be submitted directly to security@sanity.io. In order to determine whether you are dealing with a security issue, ask yourself these two questions:

  • Can I access something that's not mine, or something I shouldn't have access to?
  • Can I disable something for other people? If the answer to either of those two questions are "yes", then you're probably dealing with a security issue. Note that even if you answer "no" to both questions, you may still be dealing with a security issue, so if you're unsure, just email us at [security@sanity.io](mailto:security@sanity.io.
@shawnlknight
Copy link

Seeing the same issue

@rexxars
Copy link
Member

rexxars commented Jan 17, 2023

Apologies for this - we mistakenly exposed these types previously - we recommend you install and migrate to using types from @portabletext/types: https://portabletext.github.io/types/

@github-actions
Copy link
Contributor

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2023
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