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

Feature: typescript used to typecheck API/AJAX responses #5392

Closed
ducin opened this issue Oct 24, 2015 · 2 comments
Closed

Feature: typescript used to typecheck API/AJAX responses #5392

ducin opened this issue Oct 24, 2015 · 2 comments
Labels
Declined The issue was declined as something which matches the TypeScript vision Out of Scope This idea sits outside of the TypeScript language design constraints Suggestion An idea for TypeScript

Comments

@ducin
Copy link

ducin commented Oct 24, 2015

Actually, it's not typescript itself, but a couple of more tools used along.

The idea is to typecheck runtime responses - whether they conform to typescript types. TS does typecheck in compille time and the AJAX responses come in runtime, therefore TS can't do that on its own. But if we use typson to dump TS types down to JSON Schemas and to use a JSON Schema validator along with it to do checking in runtime. The idea is also described in lbovet/typson#37.

I know typson is not a part of typescript. But it's doable to configure such tool stack for developers. And the benefits would be really great to typecheck a real API, especially, that developers (end-users of typescript) woudln't have to write anything more than they do now (as long as the AJAX calling function, whatever it is, calls the provided ts-json-schema-validation-mechanism function).

It could be also a built-in feature of TypeScript, though, it would create a dependency on typson, which might not be what you want. What do you think of such idea? Are you interested in using typescript to do runtime API typecheck?

@ducin ducin changed the title fea Feature: typescript used to typecheck API/AJAX responses Oct 24, 2015
@DanielRosenwasser
Copy link
Member

This seems related to #1573 and #5125.

@mhegazy
Copy link
Contributor

mhegazy commented Nov 13, 2015

I do not think this belongs in the core compiler. as you mentioned. I would say you need an extensible emitter in the TS compiler, that you can leverage to get to what what you want. see my comment in #5125 (comment) for more details.

@mhegazy mhegazy closed this as completed Nov 13, 2015
@mhegazy mhegazy added Suggestion An idea for TypeScript Declined The issue was declined as something which matches the TypeScript vision Out of Scope This idea sits outside of the TypeScript language design constraints labels Nov 13, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Declined The issue was declined as something which matches the TypeScript vision Out of Scope This idea sits outside of the TypeScript language design constraints Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants