-
Notifications
You must be signed in to change notification settings - Fork 10
fix: restore missing Netlify global type in @netlify/functions
#434
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
Changes from all commits
1fe6b21
2b32dcb
e8bd38b
2e972b7
daded77
7724041
923385e
8100742
d6e828f
6ce5bce
33b8ec5
4f30a4d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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>() | ||
serhalp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| expectTypeOf<typeof Netlify>().toHaveProperty('env') | ||
| expectTypeOf<typeof Netlify>().toHaveProperty('context') | ||
serhalp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }) | ||
| }) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
| "removeComments": false, | ||
| "strict": true, | ||
| "moduleResolution": "node", | ||
| "skipLibCheck": true, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See explanation in 33b8ec5 😅 |
||
| "forceConsistentCasingInFileNames": true | ||
| }, | ||
| "include": ["src", "dev"] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,12 +4,12 @@ import { fileURLToPath } from 'node:url' | |
|
|
||
| import { expect, expectTypeOf, test } from 'vitest' | ||
|
|
||
| import { Context, NetlifyGlobal } from './main.js' | ||
| import type { Context, NetlifyGlobal } from './main.js' | ||
| import * as main from './main.js' | ||
|
|
||
| test('Exports types', () => { | ||
| expectTypeOf<Context>() | ||
| expectTypeOf<NetlifyGlobal>() | ||
| expectTypeOf<Context>().toExtend<object>() | ||
| expectTypeOf<NetlifyGlobal>().toExtend<object>() | ||
|
Comment on lines
+11
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. turns out these existing vitest type assertions weren't doing anything |
||
| }) | ||
|
|
||
| test('Does not export runtime code', () => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { defineConfig } from 'vitest/config' | ||
|
|
||
| export default defineConfig({ | ||
| test: { | ||
| typecheck: { | ||
| enabled: true, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the existing vitest type assertions in |
||
| }, | ||
| }, | ||
| }) | ||
Uh oh!
There was an error while loading. Please reload this page.