Skip to content
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

Enhance typing for intrinsic type #292

Closed
Tracked by #2564
tadelesh opened this issue Feb 22, 2024 · 2 comments
Closed
Tracked by #2564

Enhance typing for intrinsic type #292

tadelesh opened this issue Feb 22, 2024 · 2 comments
Assignees
Labels
bug Something isn't working lib:tcgc Issues for @azure-tools/typespec-client-generator-core library

Comments

@tadelesh
Copy link
Member

Current logic, all intrinsic type will convert to unknown which is not correct, need to be fixed.

if (context.program.checker.isStdType(type) || type.kind === "Intrinsic") {
let kind: SdkBuiltInKinds = "any";
if (type.kind === "Scalar") {
kind = getScalarKind(type);
}
return {
...getSdkTypeBaseHelper(type, kind),
encode: getEncodeHelper(context, type, kind),
};

@tadelesh tadelesh added bug Something isn't working lib:tcgc Issues for @azure-tools/typespec-client-generator-core library Blocking labels Feb 22, 2024
@tadelesh tadelesh removed the Blocking label Feb 23, 2024
@tadelesh
Copy link
Member Author

tadelesh commented Feb 23, 2024

Intrinsic types contain: ErrorType, void, never, unknown, null.
ErrorType: I have no idea when we will get this type. Currently, it seems nowhere for operation, parameter, properties and so on. @timotheeguerin could you give some hint?
void, never: I think we will not get such types if we use the API provided by compiler.
unknown: to any.
null: I think it is only used in union as string | null and it is handled in union types as nullable, we don't need to take care of it separately unless there is any scenario that I'm not aware of.

@tadelesh tadelesh self-assigned this Feb 23, 2024
@tadelesh
Copy link
Member Author

Close for now since there is no real case which has such problem.

@tadelesh tadelesh closed this as not planned Won't fix, can't repro, duplicate, stale Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lib:tcgc Issues for @azure-tools/typespec-client-generator-core library
Projects
None yet
Development

No branches or pull requests

2 participants