Skip to content

Commit 1686c6c

Browse files
committed
Switch to "type": "module" in package.json
1 parent 12af59a commit 1686c6c

20 files changed

+45
-194
lines changed

eslint.config.mjs renamed to eslint.config.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ export default typescriptEslint.config(
1818
languageOptions: {
1919
parserOptions: {
2020
projectService: true,
21-
// @ts-expect-error: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'NodeNext'.
22-
// Ignore this until we manage to move away from `"module": "CommonJS"`.
2321
tsconfigRootDir: import.meta.dirname,
2422
},
2523
},

examples/decode-constrained.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import "../tests/helpers";
1+
import "../tests/helpers.js";
22

33
import { expect, test } from "vitest";
44

@@ -9,7 +9,7 @@ import {
99
format,
1010
primitiveUnion,
1111
string,
12-
} from "../";
12+
} from "../index.js";
1313

1414
test("decode constrained", () => {
1515
const codec1 = fields({

examples/extra-fields.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect, test } from "vitest";
22

3-
import { Codec, fields, map, number, string } from "..";
4-
import { run } from "../tests/helpers";
3+
import { Codec, fields, map, number, string } from "../index.js";
4+
import { run } from "../tests/helpers.js";
55

66
test("adding extra fields to records", () => {
77
// Want to add an extra field to a record, that doesn’t look at the input at

examples/readme.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import {
1212
number,
1313
string,
1414
undefinedOr,
15-
} from "..";
16-
import { run } from "../tests/helpers";
15+
} from "../index.js";
16+
import { run } from "../tests/helpers.js";
1717

1818
test("the main readme example", () => {
1919
type User = {

examples/recursive.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
record,
1111
recursive,
1212
string,
13-
} from "../";
13+
} from "../index.js";
1414

1515
test("recursive data structure", () => {
1616
// Consider this recursive data structure:

examples/renaming-union-field.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expectType, TypeEqual } from "ts-expect";
22
import { expect, test } from "vitest";
33

4-
import { Infer, InferEncoded, number, tag, taggedUnion } from "../";
4+
import { Infer, InferEncoded, number, tag, taggedUnion } from "../index.js";
55

66
test("using different tags in JSON and in TypeScript", () => {
77
// Here’s how to use different keys and values in JSON and TypeScript.

examples/taggedUnion-fallback.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { expectType, TypeEqual } from "ts-expect";
22
import { expect, test } from "vitest";
33

4-
import { Codec, Infer, number, tag, taggedUnion } from "../";
5-
import { run } from "../tests/helpers";
4+
import { Codec, Infer, number, tag, taggedUnion } from "../index.js";
5+
import { run } from "../tests/helpers.js";
66

77
test("taggedUnion with fallback for unknown tags", () => {
88
// Here’s a helper function that takes a codec – which is supposed to be a

examples/taggedUnion-with-common-fields.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import {
1111
string,
1212
tag,
1313
taggedUnion,
14-
} from "../";
15-
import { run } from "../tests/helpers";
14+
} from "../index.js";
15+
import { run } from "../tests/helpers.js";
1616

1717
test("taggedUnion with common fields", () => {
1818
// This function takes two codecs for object types and returns

examples/tuples.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { expect, test } from "vitest";
22

3-
import { Codec, fields, map, number, tuple } from "../";
3+
import { Codec, fields, map, number, tuple } from "../index.js";
44

55
test("decoding tuples", () => {
66
type PointTuple = [number, number];

examples/type-annotations.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { expect, test } from "vitest";
22

3-
import { Codec, DecoderResult, fields, number, string } from "../";
3+
import { Codec, DecoderResult, fields, number, string } from "../index.js";
44

55
test("type annotations", () => {
66
// First, a small test type and a function that receives it:

0 commit comments

Comments
 (0)