Comments (15)
You can create a PR with small change here:
tst-reflect/transformer/src/config.ts
Lines 220 to 229 in 53b56ac
Add the new module kind to line 228.
from tst-reflect.
Published in [email protected]
.
TY for the PR.
from tst-reflect.
Hmm, looks like it's still happening, https://stackblitz.com/edit/tst-reflect-issue-49-kdukpz
Get ctor
is generated properly, but it adds this
const _ßr = require("tst-reflect");
from tst-reflect.
Should be fixed in [email protected]
and [email protected]
.
Also there was some trouble with typelib
mode in nodenext module, cuz of code related to ts-node. Hope it'll be okay.
from tst-reflect.
With ts-node. Not aware of any issues, i know it won't accept .ts
extension though. Even .ts
files have to be imported with .js
.
from tst-reflect.
There's a require statement inserted in meta-writer/type-lib/TypeLibMetadataNodeGenerator.ts
and
meta-writer/inline/InlineMetadataNodeGenerator.ts
factory.createIdentifier("require"),
I think that's why.
from tst-reflect.
There are some other places where are the requires generated, without using the isESMModule function.
But now I don't know if we modified the isESMModule correctly. It's not just the "module" option but combination with "moduleResolution" or package.json setting. I need to look into it a little bit.
from tst-reflect.
yeah, you might be right. I was asking about top-level await in the typescript repo and they pointed me to this.
https://www.typescriptlang.org/tsconfig#moduleResolution
It has to be set to nodenext
apparently.
from tst-reflect.
import { ExpressionKind, } from 'tst-expression';
^^^^^^^^^^^^^^
SyntaxError: Named export 'ExpressionKind' not found. The requested module 'tst-expression' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'tst-expression';
const { ExpressionKind, } = pkg;
Can you add a esm export to the packages?
from tst-reflect.
Oh look's like there is one issue. In es mode, imports have to use .js
extension for relative imports. getCtor()
will have to change. Currently, it's like import("./index")
from tst-reflect.
@avin-kavish Do you test it with ttsc or ts-node?
I found some note - from another contributor solving issues for ts-node - saying that ts-node has some issues with extensions .js/.ts so we removed the extensions cuz of it. But it was before nodenext option. They have to fixed it cuz of nodenext IMHO.
from tst-reflect.
Try [email protected]
, [email protected]
from tst-reflect.
woot! works now.
from tst-reflect.
hmm... got another undefined
getCtor()
case
from tst-reflect.
I'm working on it. 👍
from tst-reflect.
Related Issues (20)
- Support decorators from TS 4.8 HOT 2
- Unable to access parameter decorators HOT 2
- [BUG] Set not comparable HOT 1
- [Question] Anyway to add it as angular transformer HOT 18
- [BUG] tst-reflect: You call getType() method directly. You have probably wrong configuration, because tst-reflect-transformer package should replace this call by the Type instance. HOT 8
- [BUG] type metadata HOT 6
- Can't get `getType<T>()` to work HOT 5
- Participation in the new version of the system HOT 52
- [BUG] Watch mode HOT 1
- Can't get function to work with create-react-app HOT 3
- [BUG] Uncaught ReferenceError: _ßr is not defined HOT 4
- [Question] npm package using tst-reflect cannot be imported HOT 1
- [BUG] Union properties are broken HOT 5
- [BUG] TS 4.9 - "[ERR] tst-reflect: You call getType() method directly..." error when following base usage examples. HOT 17
- [Question] Comparison of Array types HOT 9
- [Question] How to get field type inside a decorator HOT 2
- [Question] Vite support HOT 3
- [Question] Does this work with functions? HOT 2
- Is there a way to use it with nestjs [Question] HOT 1
- Generic Type at runTime HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tst-reflect.