Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/edge-functions/prod/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { NetlifyGlobal } from '@netlify/types'

declare global {
// Using `var` so that the declaration is hoisted in such a way that we can
// reference it before it's initialized.

// Using `var` instead of `const` to allow TypeScript declaration merging.
// Multiple packages can declare the same global with `var`, but `const` cannot be redeclared.
var Netlify: NetlifyGlobal
}

Expand Down
4 changes: 3 additions & 1 deletion packages/functions/prod/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { NetlifyGlobal } from '@netlify/types'

declare global {
const Netlify: NetlifyGlobal
// Using `var` instead of `const` to allow TypeScript declaration merging.
// Multiple packages can declare the same global with `var`, but `const` cannot be redeclared.
var Netlify: NetlifyGlobal
}

export { builder } from './lib/builder.js'
Expand Down
5 changes: 2 additions & 3 deletions packages/runtime/src/lib/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import type { Context, NetlifyGlobal } from '@netlify/types'
import { GlobalScope } from './util.js'

declare global {
// Using `var` so that the declaration is hoisted in such a way that we can
// reference it before it's initialized.

// Using `var` instead of `const` to allow TypeScript declaration merging.
// Multiple packages can declare the same global with `var`, but `const` cannot be redeclared.
var Netlify: NetlifyGlobal
}

Expand Down