Skip to content

Commit

Permalink
Merge branch 'release/v0.20.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
holtwick committed Jun 21, 2024
2 parents f17a4ff + d1a47cc commit a114629
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 20.x
registry-url: 'https://registry.npmjs.org'
- run: npm version
- run: npm install
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ _archive
.npmrc*
lib
docs
_sandbox
# _sandbox
22 changes: 22 additions & 0 deletions _sandbox/using-class.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bun

/* eslint-disable no-console */

class TempFile implements Disposable {
constructor(path: string) {
console.log('2 constructor')
}

[Symbol.dispose]() {
console.log('4 dispose')
}
}

function fn() {
using f = new TempFile('abc')
console.log('3 fn return')
}

console.log('1 fn before')
fn()
console.log('5 fn after')
32 changes: 32 additions & 0 deletions _sandbox/using.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bun

/* eslint-disable no-console */

// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html

// try {
// // @ts-expect-error just a polyfill
// Symbol.dispose ??= Symbol("Symbol.dispose")
// // @ts-expect-error just a polyfill
// Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose")
// } finally { }

function useTempFile(path: string) {
console.log('2 constructor')
return {
path,
[Symbol.dispose]() {
console.log('4 dispose')
}
}
}

function fn() {
using f = useTempFile('abc')
console.log('x using return:', f)
console.log('3 fn return')
}

console.log('1 fn before')
fn()
console.log('5 fn after')
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zeed",
"type": "module",
"version": "0.20.8",
"version": "0.20.9",
"description": "🌱 Simple foundation library",
"author": {
"name": "Dirk Holtwick",
Expand Down

0 comments on commit a114629

Please sign in to comment.