Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ export default tseslint.config(

// Custom assertion functions
'assertNetlifyToml',

// Vitest type testing functions
'expectTypeOf',
],
},
],
Expand Down
13 changes: 13 additions & 0 deletions packages/functions/src/global-types.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { describe, test, expectTypeOf } from 'vitest'
import type { NetlifyGlobal } from '@netlify/types'

// Import the main module to ensure global augmentation is loaded
import './main.js'

describe('Netlify global type declaration regression test', () => {
test('should augment global scope with `Netlify` global', () => {
expectTypeOf<typeof Netlify>().toEqualTypeOf<NetlifyGlobal>()
expectTypeOf<typeof Netlify>().toHaveProperty('env')
expectTypeOf<typeof Netlify>().toHaveProperty('context')
})
})
6 changes: 6 additions & 0 deletions packages/functions/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import type { NetlifyGlobal } from '@netlify/types'

declare global {
const Netlify: NetlifyGlobal
}

export { builder } from './lib/builder.js'
export { purgeCache } from './lib/purge_cache.js'
export { schedule } from './lib/schedule.js'
Expand Down
Loading