Skip to content

Rename .ts files to .d.ts files - #105

Merged
ttt43ttt merged 7 commits into
TechStark:mainfrom
ocavue:ocavue/rename-ts-to-dts
Aug 1, 2026
Merged

Rename .ts files to .d.ts files#105
ttt43ttt merged 7 commits into
TechStark:mainfrom
ocavue:ocavue/rename-ts-to-dts

Conversation

@ocavue

@ocavue ocavue commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

Currently, the TypeScript declarations are stored in .ts files, and we use tsc to compile them into .d.ts files. This step is unnecessary, and we don't really want all those .js and .js.map files under dist/ . We can simply place all TypeScript declarations directly in .d.ts files.

This pull request includes the following changes:

  1. Rename all .ts files to .d.ts files under src/.
  2. Update the types field in package.json to point directly to src/index.d.ts.
  3. Modify tsconfig.json:
    • Add "noEmit": true so that no ./dist/**/*.d.ts files will be generated anymore.
    • Add "skipLibCheck": false to ensure that tsc still verifies our code. More on that below.
    • Add "types": [] to prevent tsc from accidentally picking node_modules/@types/node. This will also be the default behavior in the upcoming TypeScript 6.0: Change default of types to [] in tsconfig.json microsoft/TypeScript#62195

Please note that I did not remove the "build": "tsc" script in package.json. We will need this script to check our .d.ts files under src/. I tested it using the following example:

# Modify a .d.ts file to rename an import to an incorrect name
❯ git diff src/types/opencv/softfloat.d.ts | tee
diff --git a/src/types/opencv/softfloat.d.ts b/src/types/opencv/softfloat.d.ts
index 2b9fa33..5d2a206 100644
--- a/src/types/opencv/softfloat.d.ts
+++ b/src/types/opencv/softfloat.d.ts
@@ -1,4 +1,4 @@
-import type { bool, int, int32_t, int64_t, uint32_t, uint64_t } from "./_types";
+import type { bool, int, int32_T, int64_t, uint32_t, uint64_t } from "./_types";

 export declare class softfloat {
   public v: uint32_t;

# Run `build` script again, and `tsc` would report the error
❯ npm run build

> @techstark/opencv-js@4.12.0-release.1 build
> tsc

src/types/opencv/softfloat.d.ts:1:26 - error TS2724: '"./_types"' has no exported member named 'int32_T'. Did you mean 'int32_t'?

1 import type { bool, int, int32_T, int64_t, uint32_t, uint64_t } from "./_types";
                           ~~~~~~~

src/types/opencv/softfloat.d.ts:14:30 - error TS2552: Cannot find name 'int32_t'. Did you mean 'uint32_t'?

14   public constructor(arg176: int32_t);
                                ~~~~~~~


Found 2 errors in the same file, starting at: src/types/opencv/softfloat.d.ts:1

@ocavue
ocavue marked this pull request as ready for review November 13, 2025 08:27
@ocavue
ocavue force-pushed the ocavue/rename-ts-to-dts branch from 4dd6dc9 to 35381d6 Compare November 13, 2025 08:33
@ocavue ocavue mentioned this pull request Nov 13, 2025
@ocavue

ocavue commented Jan 27, 2026

Copy link
Copy Markdown
Contributor Author

@ttt43ttt Hi. Do you want me to rebase this pull request and resolve the conflicts?

@ttt43ttt

Copy link
Copy Markdown
Contributor

@ttt43ttt Hi. Do you want me to rebase this pull request and resolve the conflicts?

yes, please

@ocavue
ocavue force-pushed the ocavue/rename-ts-to-dts branch from 35381d6 to 64e0ffc Compare January 29, 2026 04:43
@ocavue

ocavue commented Jan 29, 2026

Copy link
Copy Markdown
Contributor Author

@ttt43ttt done

@ttt43ttt

Copy link
Copy Markdown
Contributor

@ocavue sorry for the delay. Could you resolve the merge conflicts?

@ocavue

ocavue commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@ttt43ttt done

@ttt43ttt
ttt43ttt merged commit c09579c into TechStark:main Aug 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants