bun-types-no-globals 1.2.21-canary.20250823T140535 → 1.2.21-canary.20250824T140615

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +15 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -42,6 +42,21 @@ export function createPlugin(): BunPlugin | WebpackPlugin | VitePlugin {
42
42
  }
43
43
  ```
44
44
 
45
+ ### 🛠️ [Re-\]declaring the Bun namespace
46
+
47
+ Sometimes you'll still want the Bun namespace to globally exist - this is most helpful in situations where actually including a runtime import from `bun` is more inconvenient than using the Bun namespace itself. You can tell TypeScript about the namespace by including this code somewhere in your program:
48
+
49
+ ```ts
50
+ // File could be called `bun.ns.d.ts` for example
51
+ import * as BunModule from 'bun';
52
+
53
+ declare global {
54
+ export import Bun = BunModule;
55
+ }
56
+ ```
57
+
58
+ I wrote a little about the above syntax [on my blog about Ambient Declarations](https://alistair.sh/ambient-declarations).
59
+
45
60
  ## Usage
46
61
 
47
62
  We recommend you require these types with a triple slash reference anywhere in your program
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bun-types-no-globals",
3
- "version": "1.2.21-canary.20250823T140535",
3
+ "version": "1.2.21-canary.20250824T140615",
4
4
  "main": "./generator/index.ts",
5
5
  "types": "./lib/index.d.ts",
6
6
  "description": "TypeScript type definitions for Bun without global types pollution",