Type providers pro TypeScript
Type providers for TypeScript
diploma thesis (DEFENDED)

View/ Open
Permanent link
http://hdl.handle.net/20.500.11956/193872Identifiers
Study Information System: 271868
Collections
- Kvalifikační práce [11325]
Author
Advisor
Referee
Bednárek, David
Faculty / Institute
Faculty of Mathematics and Physics
Discipline
Computer Science - Software Systems
Department
Department of Distributed and Dependable Systems
Date of defense
11. 9. 2024
Publisher
Univerzita Karlova, Matematicko-fyzikální fakultaLanguage
English
Grade
Excellent
Keywords (Czech)
type providers|TypeScript|data access|code generationKeywords (English)
type providers|TypeScript|data access|code generationTypové systémy programovacích jazyků obecně nerozumí externím datům. Ve staticky typovaných programovacích jazycích vývojáři pro práci s daty vytvářejí typy a přístupový kód buď ručně nebo s použitím externích nástrojů pro generování kódu. Mechanismus type providers, původně vyvinutý pro jazyk F#, představuje alternativní přístup ke gen- erování kódu, který zlepšuje jak bezpečnost v době kompilace, tak efektivitu vývojářů, za pomoci odvozování typů ze vzorků dat. Tato práce zkoumá implementaci type providers v jazyce TypeScript. V rámci práce jsme navrhli řešení a implementovali funkční prototyp ve formě rozšíření současného překladače TypeScriptu. Užitečnost této funkce demonstrujeme implementací type provider balíčků pro CSV, XML a JSON. 1
Type systems of programming languages generally do not understand external data. In statically typed programming languages, developers handle data by writing typed interfaces and data access code by hand or using external code generation tools. Type providers, originally developed for F#, are an alternative, more integrated approach to code generation that improves compile-time safety and developer experience by inferring types from data samples. This thesis explores the implementation of type providers in TypeScript. We propose a design for the feature and implement a functional prototype as an extension of the current TypeScript compiler. We demonstrate the feature's usefulness by implementing type provider packages for CSV, XML and JSON. 1