From b3bc866d441eeead32ab5503d2f9565e25c0a0d1 Mon Sep 17 00:00:00 2001 From: Allison Pratt <47452487+allisons11@users.noreply.github.com> Date: Fri, 27 Oct 2023 10:41:27 -0400 Subject: [PATCH] chore: add tsconfig.json to basic example (#4372) Co-authored-by: Vladimir --- examples/basic/src/basic.ts | 1 + examples/basic/test/basic.test.ts | 6 ++++++ examples/basic/tsconfig.json | 13 +++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 examples/basic/src/basic.ts create mode 100644 examples/basic/tsconfig.json diff --git a/examples/basic/src/basic.ts b/examples/basic/src/basic.ts new file mode 100644 index 000000000000..d9370519aaea --- /dev/null +++ b/examples/basic/src/basic.ts @@ -0,0 +1 @@ +export const squared = (n: number) => n * n diff --git a/examples/basic/test/basic.test.ts b/examples/basic/test/basic.test.ts index 0f6d96168861..f318a8f3f029 100644 --- a/examples/basic/test/basic.test.ts +++ b/examples/basic/test/basic.test.ts @@ -1,4 +1,5 @@ import { assert, expect, test } from 'vitest' +import { squared } from '../src/basic.js' // Edit an assertion and save to see HMR in action @@ -8,6 +9,11 @@ test('Math.sqrt()', () => { expect(Math.sqrt(2)).toBe(Math.SQRT2) }) +test('Squared', () => { + expect(squared(2)).toBe(4) + expect(squared(12)).toBe(144) +}) + test('JSON', () => { const input = { foo: 'hello', diff --git a/examples/basic/tsconfig.json b/examples/basic/tsconfig.json new file mode 100644 index 000000000000..0f69c02d2fa9 --- /dev/null +++ b/examples/basic/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "module": "node16", + "target": "es2020", + "strict": true, + "verbatimModuleSyntax": true, + "declaration": true, + "sourceMap": true, + "declarationMap": true + }, + "include": ["src", "test"], + "exclude": ["node_modules"] +}