-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for ttypescript (ttsc) #401
Comments
Good idea, let's try it |
This is supported now since v1.0.1-alpha.94. example tsconfig.json: {
"compilerOptions": {
"plugins": [
{ "transform": "@deepkit/type-compiler" }
]
},
"reflection": true
} |
@marcj what are the dependencies, requirements and settings to get this going? (do you have an example?) I tried it with a basic {
"reflection": true, // DeepKit
"compilerOptions": {
"plugins": [
{ "transform": "@deepkit/type-compiler" }
],
"target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"module": "NodeNext", /* Specify what module code is generated. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
"strict": true, /* Enable all strict type-checking options. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
} And {
"name": "try-deepkit",
"scripts": {
"start": "ttsc src/hello.ts"
},
"devDependencies": {
"@deepkit/type-compiler": "^1.0.1-alpha.97",
"ttypescript": "^1.5.15",
"typescript": "^5.0.4"
}
} My At
|
@mindplay-dk you error refers to an incompatibility of ttransformer with TypeScript 5. See their repository for more information , cevek/ttypescript#147. It seems it is unmaintained though |
I see, yeah - it looks like people are migrating to ts-patch, which should support v5 with the latest beta - so I decided to give that a shot. Updated {
"name": "try-deepkit",
"scripts": {
"prepare": "ts-patch install -s",
"start": "tspc src/hello.ts"
},
"devDependencies": {
"@deepkit/type-compiler": "^1.0.1-alpha.97",
"typescript": "^5.0.4"
},
"dependencies": {
"@deepkit/type": "^1.0.1-alpha.97",
"ts-patch": "^3.0.0-beta3"
}
} It now appears to actually run the DeepKit transformer - but now that errors:
For some reason it can't find the Here's import { typeOf } from '@deepkit/type';
function log(message: string): void {
console.log(message);
}
//console.log(typeOf(log)); The ts-patch README says "Based on ttypescript - Fully compatible", but yeah, who knows. Could you give All you should need to change is the command named from |
Hmm, it looks like there's a missing dependency on It probably should be moved from deepkit-framework/packages/type/package.json Lines 29 to 42 in 2ffaeb6
Note that all I did in my test-script is I did finally get to "hello world" with TS5 + I see you have Vite support now as well though? That might be better for DX? 🙂 |
Are you aware of ttypescript (
ttsc
)? two t's, not a typo 😅I don't see any mentions in either issues or discussions, so I thought I'd bring it up.
I don't know if DeepKit is mainly a set of TypeScript transformers, or if there's more going on?
If it would work with just the two transformers,
ttsc
might be a way to avoid doing the install-time transformations you're doing now - and also would provide access to a small ecosystem of other transforms.ttsc
already has integrations with tools like WebPack, RollUp, Parcel and VS Code, so this might also be a way to make DeepKit more generally available to the wider JS ecosystem and get some more exposure.I haven't really looked into it yet, but if the transforms are already exported, it might work with the
ttsc
already, with the right configuration?I figured I'd ask before spending time on it though - I figured the developers might already have considered that and maybe there's some reason this isn't going to work?
The text was updated successfully, but these errors were encountered: