Comments (4)
It seems like your tsconfig is not configured to allow TypeScript to resolve the “package.json” exports field.
This can be set using the “moduleResolution” option in your tsconfig. I would recommend “bundler” if you are using TypeScript 5, otherwise an option like “node16” or “nodenext” should work.
from yoga.
That does work for Typescript users, but what about Javascript users? They will have no tsconfig file. For example, my Visual Studio Code examples apply to Javascript users. They will essentially have no intellisense. Maybe that should be left for IDEs to implement though.
Do you think adding an index.d.ts file would be incorrect? I've never really dealt with type definitions and export maps in other projects.
from yoga.
I had originally had an extra “index.js” and “sync.js” files to try to catch clients which weren’t configured to support the exports field, but it ended up instead seeming like more churn than worth it.
It effectively means that you can transparently get opted out of platform conditions, and makes it very easy to get mismatched types from source.
I think the field will continue to become more common, and new out-of-the-box tsconfig for Node and frameworks do now tend to choose a compatible option. https://github.com/tsconfig/bases/tree/main/bases
As that continues, I would expect that VSCode learns to do ES Module resolution when a configuration file isn’t present, but IDE usage of types in an otherwise untyped project isn’t something I’ve tried to really test.
from yoga.
Cool, sounds good, I'll close the issue.
from yoga.
Related Issues (20)
- EXC_BAD_ACCESS in `new yoga::Config(getDefaultLogger())` when building for iOS 14 using Xcode 15 HOT 4
- Yoga does not respect automatic minimum size for flexbox items HOT 11
- Yoga.Node.create(), Node is undefined HOT 5
- Different handling of aspect ratio on flexible items compared to CSS HOT 3
- Support `Start` and `End` alignment keywords
- Absolute children do not respect padding of parent HOT 1
- [!] An error occurred while processing the post-install hook of the Podfile. HOT 1
- Can run on Mac Catalyst, but cannot be archive on Mac Catalyst HOT 10
- wasm-sync file index error in package.json HOT 2
- [website-next] Replace Yoga Node Editor with `@theme/CodeBlock` HOT 8
- Add `YGNodeStyleSet<Property>CSS` for CSS values as strings HOT 1
- Add `yoga::Style::resolve()` for ahead-of-time computed whole style HOT 2
- Try using explicit modulemap in CocoaPods build HOT 1
- Typo in recent module.modulemap change that breaks Swift PM-based builds HOT 1
- [JS] Move from embind to manual bindings HOT 1
- Flex shorthand in UseWebDefaults should set basis to 0 instead of auto HOT 3
- React Native iOS build failed HOT 1
- top position is wrong when previous item's height is 0.5, on 3x scale screen HOT 1
- API proposal to get the computed measure size of a node HOT 9
- Proposal: Integrate with google/oss-fuzz for continuous fuzz testing? HOT 9
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 yoga.