Comments (2)
The guard function needs to refer to the type for its param is Type
return type. How would it do that if the type is not exported?
You can't do this while manually writing a guard file, so I don't see how a library could do it.
Unless you want a guard written into an existing file instead of being written into a separate file. That seems like there's more risk of damaging an existing code file.
I'm not necessarily opposed to it as a feature. ts-morph can pretty safely modify existing files, and version control minimizes the risk of catastrophic mistakes, but that's not something this library has ever done as far as I know.
I'm curious what you're trying to do. Is there a reason you can't export your type?
from ts-auto-guard.
I thought that I could manage codes more efficiently if I manage types in the same file.
But I decided to split types into separate files. So it doesn't matter now. :)
from ts-auto-guard.
Related Issues (20)
- Ability to specify guard file destination folder? HOT 10
- Allow JSDoc comments to temporarily overwrite certain CLI options HOT 5
- Annotated type must still be exported HOT 3
- Implement an "auto-cast" feature HOT 3
- Check for string length and number range HOT 5
- Double quoted property names HOT 4
- Type guards not compatible with noImplicitAny HOT 1
- Dependency tracking system uses declared names for imported types/guards/classes HOT 3
- Debug build does not quote the type of Record keys HOT 2
- Doesn't correctly handle T types. HOT 2
- Improvement to usage docs HOT 2
- Support for explicit file extensions when using ESM HOT 4
- Rest elements in Tuple Types to support NonEmptyArray HOT 1
- Paths are not always replaced shortened on Windows
- RangeError: Maximum call stack size exceeded HOT 3
- Throw if file not found HOT 1
- Feature request: add `-r` recursive option HOT 2
- Type aliases produce type guards with TS errors (TS6133) HOT 1
- Incorrect type guard generated when using constant for interface keys HOT 3
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 ts-auto-guard.