Kotlin / Kotlin/dukat

Converting a lot of *.d.ts files

Open
#2 4 comments 1 reaction 0 assignees View on GitHub
performance
Dominant language
Kotlin
Stars
591
Forks
40
PR merge metrics
No merged PRs in 30d

Description

There are such large projects, written directly in TypeScript and contains complex directory structure with a lot of files (hundreds). Such projects are compiled with option `--declaration` (which autogenerate `*.d.ts` for each `*.ts` files) and [published](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) directly to `npm`
Trying to convert typings of such project, I ran into a number of problems. Here are some of them:

1. Need option to specify directory, from which `dukat` will take `*.d.ts` files recursively and put result to destination directory keeping source directory structure. It could be resolved with some scripting, but...
2. I've tried to specify 200+ `*.d.ts` files via `$ dukat /path/to/**/*.d.ts`. It takes `> 1 hour` to convert them (2-4 files per minute)
3. Option `-b some_package_name` gave no effect. Each file get same package name as it file name. It also don't work for single file. I expect that I can specify same package name for all files. Ability to specify `@file:JsModule("path-to-module")` would be also useful.
4. Interface names like `'T$0'` will be duplicated, because each file converted independently.
5. If one `external class` implement interface from another file, there are no `override` modifier, because each file converted independently.
6. _Notice_: as mentioned [here](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) `package.json` could contain `types` property or `index.d.ts` at the root of the package. It would be nice if also it were ability to analyze dependencies starting from `index.d.ts` before just converting all files from npm package.
Also mainly `index.d.ts` contains re-exports.

Contributor guide

No contributing guide indexed for this repository

Research direction

No source files or tests are named. Start by tracing the dukat CLI handling of recursive *.d.ts inputs and the -b option, then examine how files are converted independently. Done would require an agreed scope and verification for directory conversion, shared package names, cross-file declarations, and index.d.ts dependency analysis.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin, typescript
Domain
cli, compilers, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.