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

Type imports from @netlify/build fail with TS 4.x #5265

Open
SferaDev opened this issue Aug 30, 2023 · 0 comments
Open

Type imports from @netlify/build fail with TS 4.x #5265

SferaDev opened this issue Aug 30, 2023 · 0 comments
Labels
type: bug code to address defects in shipped code

Comments

@SferaDev
Copy link

SferaDev commented Aug 30, 2023

Describe the bug

After updating to @netlify/build@29.20.7 imports began failing.

import type { OnPreBuild } from '@netlify/build';

export const onPreBuild: OnPreBuild = async function ({ netlifyConfig }) {
    // Your plugin code
}

Steps to reproduce

  1. Use TypeScript 4.x (works with TS 5.x)
  2. Update from 29.20.6 to 29.20.7
  3. Run tsc

Configuration

tsconfig:

{
  "compilerOptions": {
    "target": "es2020",
    "lib": ["esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "es2020",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": false,
    "outDir": "dist",
    "declaration": true
  },
  "include": ["src"],
  "exclude": ["node_modules"]
}

Logs

  Error: src/index.ts(1,15): error TS2614: Module '"@netlify/build"' has no exported member 'OnPreBuild'. Did you mean to use 'import OnPreBuild from "@netlify/build"' instead?
  Error: src/index.ts(9,57): error TS7031: Binding element 'netlifyConfig' implicitly has an 'any' type.
@SferaDev SferaDev added the type: bug code to address defects in shipped code label Aug 30, 2023
@SferaDev SferaDev changed the title Please replace with a clear and descriptive title Type imports from @netlify/build fail with type checker Aug 30, 2023
@SferaDev SferaDev changed the title Type imports from @netlify/build fail with type checker Type imports from @netlify/build fail with TS 4.x Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

1 participant