Skip to content

Commit 49e48ca

Browse files
committed
Use tsgo
1 parent dafc84e commit 49e48ca

15 files changed

Lines changed: 51 additions & 30 deletions

File tree

bun.lock

Lines changed: 18 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
"tag": "bun tag.js",
1616
"bump": "bun bump.js",
1717
"stories": "ladle serve",
18-
"build": "tsc && bun build.ts",
18+
"build": "tsgo --noEmit false --declaration --emitDeclarationOnly && bun build.ts",
1919
"lint": "oxlint --ignore-path .gitignore .",
2020
"lint:fix": "oxlint --fix --ignore-path .gitignore .",
2121
"format": "oxfmt --write .",
2222
"format:check": "oxfmt --check .",
2323
"cycles:server": "CHECK_CYCLES=server bun build.ts && bunx --bun madge --warning --circular dist/index.js",
2424
"cycles:browser": "CHECK_CYCLES=browser bun build.ts && bunx --bun madge --warning --circular dist/index.js dist/ui.js dist/dashboard/App.js",
25-
"type": "tsc --diagnostics",
26-
"dev:check": "tsc -w",
25+
"type": "tsgo --diagnostics",
26+
"dev:check": "tsgo -w",
2727
"dev:run": "bun build.ts --watch -- node dev.js --dir apps/dev -- bun run --cwd apps/dev dev",
2828
"web:run": "bun build.ts --watch -- node dev.js -- bun run --cwd apps/web dev",
2929
"trace": "tsc --diagnostics --generateTrace private/trace && analyze-trace private/trace & speedscope private/trace/trace.json",
@@ -89,7 +89,7 @@
8989
"sharp": "0.32.6",
9090
"speedscope": "^1.14.0",
9191
"symlink-dir": "^6.0.5",
92-
"typescript": "5.6.2",
92+
"@typescript/native-preview": "7.0.0-dev.20260325.1",
9393
"typescript-plugin-css-modules": "^5.2.0",
9494
"yjs-src": "npm:yjs@13.6.11"
9595
},
@@ -134,4 +134,4 @@
134134
"default": "./dist/picker/url/UrlPicker.js"
135135
}
136136
}
137-
}
137+
}

src/adapter/next/handler.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ import {
66
createHandler as createCoreHandler,
77
type HandlerHooks
88
} from 'alinea/backend/Handler'
9-
import {proxy} from 'alinea/backend/router/Proxy'
109
import {generatedSource} from 'alinea/backend/store/GeneratedSource'
1110
import {JWTPreviews} from 'alinea/backend/util/JWTPreviews'
1211
import {CloudRemote} from 'alinea/cloud/CloudRemote'
13-
import {Config} from 'alinea/core/Config'
1412
import type {RemoteConnection, RequestContext} from 'alinea/core/Connection'
1513
import {LocalDB} from 'alinea/core/db/LocalDB'
1614
import PLazy from 'p-lazy'

src/backend/api/OAuth2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ export class OAuth2 implements AuthApi {
8686
this.#client = new OAuth2Client({
8787
...options,
8888
authenticationMethod: 'client_secret_basic_interop',
89-
async fetch(input: RequestInfo | URL, init?: RequestInit) {
89+
fetch: (async (input, init) => {
9090
const request = new Request(input, init)
9191
const response = await fetch(request)
9292
if (!response.ok) {
9393
const text = await response.text()
9494
throw new HttpError(response.status, text)
9595
}
9696
return response
97-
}
97+
}) as typeof fetch
9898
})
9999
const loadJwks = async (): Promise<Array<JsonWebKey & {kid: string}>> => {
100100
try {

src/backend/router/Proxy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const hopByHopHeaders = [
1111
'upgrade'
1212
]
1313

14-
export const proxy: typeof fetch = async (input, init) => {
14+
export const proxy = (async (input, init) => {
1515
const request = new Request(input, init)
1616
request.headers.delete('accept-encoding')
1717
const response = await fetch(request)
@@ -26,4 +26,4 @@ export const proxy: typeof fetch = async (input, init) => {
2626
statusText: response.statusText,
2727
headers: headers
2828
})
29-
}
29+
}) as typeof fetch

src/cli/serve/CreateLocalServer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export function createLocalServer(
179179
if (ifNoneMatch && ifNoneMatch === etag)
180180
return new Response(undefined, {status: 304})
181181
const extension = path.extname(fileName)
182-
return new Response(file.contents, {
182+
return new Response(file.contents as BodyInit, {
183183
headers: {
184184
'content-type': mimeTypes.get(extension) || 'application/octet-stream',
185185
etag

src/core/db/Operation.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,14 @@ export class UploadOperation extends Operation {
212212
const uploadLocation = join(directory, path + extension)
213213
const info = await db.prepareUpload(uploadLocation)
214214
const previewData = isImage(fileName)
215-
? await createPreview?.(file instanceof Blob ? file : new Blob([body]))
215+
? await createPreview?.(
216+
file instanceof Blob ? file : new Blob([body as BlobPart])
217+
)
216218
: undefined
217219
await fetch(info.url, {
218220
method: info.method ?? 'POST',
219221
headers: {'Content-Type': contentType},
220-
body
222+
body: body as BodyInit
221223
}).then(result => {
222224
if (!result.ok)
223225
throw new HttpError(

src/core/source/GitDelta.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ function writeUint32BE(target: Uint8Array, offset: number, value: number) {
272272
}
273273

274274
async function zlibCompress(data: Uint8Array): Promise<Uint8Array> {
275-
const blob = new Blob([data])
275+
const blob = new Blob([data as BlobPart])
276276
const compressed = new Response(
277277
blob.stream().pipeThrough(new CompressionStream('deflate'))
278278
)

src/core/source/Utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import {crypto} from '@alinea/iso'
44
* Computes the SHA-1 hash bytes of the input data.
55
*/
66
export async function sha1Bytes(data: Uint8Array): Promise<Uint8Array> {
7-
const hashBuffer = await crypto.subtle.digest('SHA-1', data)
7+
const hashBuffer = await crypto.subtle.digest(
8+
'SHA-1',
9+
data as BufferSource
10+
)
811
return new Uint8Array(hashBuffer)
912
}
1013

src/core/util/BufferToBase64.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const encode = async (
3838
buffer: ArrayBuffer | Uint8Array,
3939
format: CompressionFormat | '' = 'deflate'
4040
) => {
41-
const blob = new Blob([buffer])
41+
const blob = new Blob([buffer as BlobPart])
4242
const res = format
4343
? new Response(blob.stream().pipeThrough(new CompressionStream(format)))
4444
: blob

0 commit comments

Comments
 (0)