Comments (7)
Okay, so I figured out part of my problem, there's double wrapping so there's an outer type that I wasn't aware of.
However, I don't think IQueryable
should be testing as an abstract interface?
from ntypewriter.
It looks like from the compiler's perspective interface is an abstract type. I do not understand your problem, and the code that you provided definitely does not give the above results. Bool is a primitive type, thus TypescriptModelName will end on the first if
.
public IQueryable<bool> Foo()
{
return null;
}
public bool Foo2()
{
return false;
}
{{- for method in class.Methods | Symbols.ThatArePublic }}
{{ method.Name }}
{{ method.ReturnType}}
{{ Custom.TypescriptModelName method.ReturnType }}
{{ method.ReturnType.IsAbstract }}
{{ method.ReturnType.IsInterface }}
{{ method.ReturnType.IsPrimitive }}
{{- end }}
Foo
IQueryable<bool>
boolean
true
true
false
Foo2
bool
boolean
false
false
true
from ntypewriter.
from ntypewriter.
Just because you can't use the abstract
keyword when typing an interface, that doesn't mean an interface is not abstract.
Consider this about abstract classes:
- You can't instantiate abstract classes with
new
. The same is true for interfaces. - When inheriting from an abstract class, you have to implement all abstract methods. This is similar to interfaces, when you implement an interface you have to implement all methods.
Interfaces are abstract.
If you think this is incorrect, then reflection is incorrect. The following writes "True":
Console.WriteLine(typeof(IEnumerable).IsAbstract); // True
from ntypewriter.
from ntypewriter.
Reflection is not wrong, it is how the C# language was designed. And you will find many more similar cases when you spend more time with static code analysis.
from ntypewriter.
I disagree.
from ntypewriter.
Related Issues (20)
- Changes from GIT not picked up by NTypewriter HOT 3
- This is perfect for AI
- Failed to compile user code (System.Collections) HOT 10
- Source Generator ArgumentNullException HOT 8
- Save function is misleading HOT 3
- `Microsoft.CodeAnalysis` not found HOT 10
- SourceGenerator can't find dependent projects HOT 2
- Publish latest releases as NuGet package HOT 4
- Template output preview is always displayed on top of everything HOT 1
- Template output preview with dark mode support
- Using C# 9.0 init accessors in a custom function gives an error inside Visual Studio extension HOT 1
- Extend AllReferencedTypes to search on Interfaces HOT 1
- Request - Property internal set vs public flag or filter HOT 3
- Action.Url does not support array-valued parameters HOT 1
- How to use builtin function LINQ.Where in template? HOT 7
- error while generating typescript services from ntypewriter runtime generator HOT 2
- Generic class with itself as argument of base type equality problem HOT 3
- How to join arrays without losing type information? HOT 2
- How to automatically render templates? HOT 2
- Incremental Generator 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 ntypewriter.