diff options
author | 2022-11-09 15:40:40 -0800 | |
---|---|---|
committer | 2022-11-09 15:40:40 -0800 | |
commit | f7f1b604443c030afe29d1059b90f72c69afe081 (patch) | |
tree | 8f2397447b2a84dab02850007264b72cc565f5d6 /test/bun.js/react-dom.test.tsx | |
parent | da257336b0b70df8c31da647496899cf70670000 (diff) | |
download | bun-f7f1b604443c030afe29d1059b90f72c69afe081.tar.gz bun-f7f1b604443c030afe29d1059b90f72c69afe081.tar.zst bun-f7f1b604443c030afe29d1059b90f72c69afe081.zip |
Add bun-types, add typechecking, add `child_process` types (#1475)
* Add bun-types to packages
* Improve typing
* Fix types in tests
* Fix dts tests
* Run formatter
* Fix all type errors
* Add strict mode, fix type errors
* Add ffi changes
* Move workflows to root
* Add workflows
* Remove labeler
* Add child_process types
* Fix synthetic defaults issue
* Remove docs
* Move scripts
* Run prettier
* Include examples in typechecking
* captureStackTrace types
* moved captureStackTrace types to globals
* Address reviews
Co-authored-by: Colin McDonnell <colinmcd@alum.mit.edu>
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
Diffstat (limited to 'test/bun.js/react-dom.test.tsx')
-rw-r--r-- | test/bun.js/react-dom.test.tsx | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/test/bun.js/react-dom.test.tsx b/test/bun.js/react-dom.test.tsx index 678f1ee9a..a05ed16a1 100644 --- a/test/bun.js/react-dom.test.tsx +++ b/test/bun.js/react-dom.test.tsx @@ -10,7 +10,7 @@ import { heapStats } from "bun:jsc"; import { describe, expect, it } from "bun:test"; import { renderToReadableStream as renderToReadableStreamBrowser } from "react-dom/server.browser"; import { gc } from "./gc"; -import { renderToReadableStream as renderToReadableStreamBun } from "./react-dom-server.bun"; +import { renderToReadableStream as renderToReadableStreamBun } from "./react-dom-server.bun.cjs"; import React from "react"; Object.defineProperty(renderToReadableStreamBrowser, "name", { @@ -93,9 +93,11 @@ describe("React", () => { it("React.createContext works", () => { expect(typeof React.createContext).toBe("function"); const pleaseDontThrow = React.createContext({ foo: true }); - expect(pleaseDontThrow.$$typeof.description).toBe("react.context"); + expect((pleaseDontThrow as any).$$typeof.description).toBe("react.context"); - const pleaseDontThrow2 = React.default.createContext({ foo: true }); + const pleaseDontThrow2 = (React as any).default.createContext({ + foo: true, + }); expect(pleaseDontThrow2.$$typeof.description).toBe("react.context"); }); }); @@ -117,7 +119,7 @@ describe("ReactDOM", () => { gc(); expect(text.replaceAll("<!-- -->", "")).toBe(inputString); gc(); - } catch (e) { + } catch (e: any) { console.log(e.stack); throw e; } @@ -159,7 +161,7 @@ describe("ReactDOM", () => { gc(); expect(text.replaceAll("<!-- -->", "")).toBe(inputString); gc(); - } catch (e) { + } catch (e: any) { console.error(e.message); console.error(e.stack); throw e; @@ -172,7 +174,7 @@ describe("ReactDOM", () => { const text = renderToReadableStream === renderToReadableStreamBun ? array.join("") - : new TextDecoder().decode(concatArrayBuffers(array)); + : new TextDecoder().decode(concatArrayBuffers(array as any[])); gc(); expect(text.replaceAll("<!-- -->", "")).toBe(inputString); gc(); @@ -189,7 +191,7 @@ describe("ReactDOM", () => { it("for await (chunk of stream)", async () => { const stream = await renderToReadableStream(reactElement); gc(); - const chunks = []; + const chunks: any = []; for await (let chunk of stream) { chunks.push(chunk); } @@ -202,12 +204,12 @@ describe("ReactDOM", () => { it("for await (chunk of stream) (arrayBuffer)", async () => { const stream = await renderToReadableStream(reactElement); gc(); - const chunks = []; + const chunks: any[] = []; for await (let chunk of stream) { chunks.push(chunk); } const text = new TextDecoder().decode( - await new Response(chunks).arrayBuffer() + await new Response(chunks as any).arrayBuffer(), ); gc(); expect(text.replaceAll("<!-- -->", "")).toBe(inputString); |