Skip to content

Commit

Permalink
chore: stricter typechecks
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jul 2, 2024
1 parent bdadfec commit 64dda9f
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 15 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"lint:fix": "eslint --fix . && prettier -w src lib test stubs",
"prepack": "pnpm build",
"release": "pnpm build && pnpm test && changelogen --release --prerelease --push --publish --publishTag 2x",
"test": "pnpm lint && vitest run --coverage && pnpm test:register && pnpm test:bun",
"test": "pnpm lint && pnpm test:types && vitest run --coverage && pnpm test:register && pnpm test:bun",
"test:types": "tsc --noEmit",
"test:register": "node ./test/register-test.mjs",
"test:bun": "bun --bun test test/bun"
},
Expand Down
2 changes: 1 addition & 1 deletion src/babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
TransformOptions as BabelTransformOptions,
PluginItem,
} from "@babel/core";
import { TransformOptions, TransformResult } from "./types";
import type { TransformOptions, TransformResult } from "./types";
import { TransformImportMetaPlugin } from "./plugins/babel-plugin-transform-import-meta";
import { importMetaEnvPlugin } from "./plugins/import-meta-env";
import transformModulesPlugin from "./plugins/transform-module";
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { isAbsolute, join } from "pathe";
import type { PackageJson } from "pkg-types";
import { interopDefault as mllyInteropDefault, pathToFileURL } from "mlly";
import { isWindows } from "std-env";
import { Context } from "./types";
import type { Context } from "./types";
import { gray, green, blue, yellow, cyan, red } from "yoctocolors";

export function isDir(filename: string | URL): boolean {
Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/fixtures.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Decorator called with 1 arguments.
file: '<cwd>/test.ts',
dir: '<cwd>',
resolve: '<cwd>/test.ts'
} undefined [class DecoratedClass]
} [class DecoratedClass]
{
satisfiesTest: {
firstTest: { name: 'first', avatar: 'https://example.com/first.png' },
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/json/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import importedWithAssertion from "./file.json" assert { type: "json" };

const required = require("./file.json");

const debug = (label: string, value) =>
const debug = (label: string, value: any) =>
console.log(label, ":", value, ".default:", value.default);

debug("Imported", imported);
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/typescript/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import test, { FeedService } from "./test";
import test, { type FeedService as _FeedService } from "./test";
import Clazz from "./decorators";
import { test as satisfiesTest } from "./satisfies";
import { child } from "./parent.mjs";

export type { Test } from "./types";

console.log(test(), FeedService, Clazz);
console.log(test(), Clazz);
console.log(satisfiesTest());
console.log(child());
23 changes: 15 additions & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "Node",
"target": "ESNext",
"module": "Preserve",
"resolveJsonModule": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"allowJs": true,
"checkJs": false,
"strict": true,
"declaration": false,
"experimentalDecorators": true,
"resolveJsonModule": true,
"types": ["node"]
"verbatimModuleSyntax": true,
"isolatedModules": true,
"forceConsistentCasingInFileNames": true,
"noImplicitOverride": true,
"noEmit": true,
"experimentalDecorators": true
},
"include": ["src", "lib"]
"include": ["src", "lib", "test"],
"exclude": ["test/fixtures/error-parse/index.ts"]
}

0 comments on commit 64dda9f

Please sign in to comment.