Comments (14)
I'm interested in working on this. I had a local fork for the 0.9 compiler that included parser changes to allow foo
strings, and was preparing to start working on emitting code.
With the new compiler work underway, what's the best way for an external contributor to help out here?
from typescript.
Thanks @duncanmak, a PR would be a good way to share your proposal with us. Since this is a bigger change than normal bug fixes, I would suggest sharing your changes early so that you can get feedback as you go.
Feel free to tag me, or email me directly if you have any questions.
Please follow the guidelines in CONTRIBUTING.md and submit a Contributor License Agreement (CLA) before submitting the pull request.
from typescript.
👍
Codeplex issue : https://typescript.codeplex.com/workitem/19
from typescript.
This would be great to have in TypeScript 👍
from typescript.
+1: A highly desirable enhancement.
from typescript.
Unless I'm missing something, codegen for < ES6 should be just a case of removing the line-end character(s) and correctly escaping single and double-quote.
from typescript.
It would be especially nice if this were to support type annotations which could be determined in the lexer. So you could annotate a string as containing HTML which editors could use to provide highlighting, autocomplete etc.
Or better yet, something similar to Nemerle's macros (see: http://nemerle.org/About).
from typescript.
As a heads up, I'm currently taking this on.
from typescript.
Implemented in #960 and #1072.
There are still some details being ironed out, but we support tagged templates on ES6 emit and untagged templates on all emit targets.
Type-checking occurs in substitution expressions, however, in an untagged template expression, there is no constraint on the type of the substitution expressions.
In a tagged template, overload resolution may occur, yielding an appropriate signature. Substitution expressions are constrained by the signature's parameters' types. A synthesized value of the new TemplateStringsArray
type corresponds to the first argument. Substitution expressions at position n correspond to an argument at position n+1. Contextual typing rules work as appropriate.
Language service support for signature help on tagged templates is in the works on #1204.
from typescript.
Hey Daniel,
This feature is a massive win, thanks for implementing.
Any chance on tagged templates getting es5 support? Is it not a more or less straightforward transformation - perhaps a __template(tag, strings, values)
function emitted to package the string arrays and invoke the tag?
Thanks again!
from typescript.
Hey @hdachev,
Really glad that you've had a good experience with this feature. Downleveled ES3/ES5 tagged templates is actually on our agenda, and @ivogabe has put out PR #1589 to implement them. So far, things look good, and I think we'll be able to lock it in for 1.5.
from typescript.
Thanks, great work guys!
On Wednesday, February 11, 2015, Daniel Rosenwasser <
[email protected]> wrote:
Hey @hdachev https://github.com/hdachev,
Really glad that you've had a good experience from this feature.
Downleveled ES3/ES5 tagged templates is actually on our agenda, and
@ivogabe https://github.com/ivogabe has put out PR #1589
#1589 to implement them. So
far, things look good, and I think we'll be able to lock it in for 1.5.—
Reply to this email directly or view it on GitHub
#13 (comment).
from typescript.
So we have string interpolation, and support for tagged templates coming up in 1.5 - these are great features, but has anyone thought about adding support for an alternative file extension for template files?
Basically just Typescript, but with the contents of the file being emitted or returned somehow, and you have to use a tag to escape from output - I guess basically EJS for Typescript.
There are lots of fine template engines for JS, but what I'm after is something that will receive the same excellent IDE support Typescript gets - I haven't found anything like that for JS. (we're a rather large team considering a transition from PHP towards Typescript+Node, and a key missing feature right now is views/templates with proper IDE support, e.g. auto-complete for a view-model and view helper-functions.)
from typescript.
@mindplay-dk I suspect this might just happen with angular support followed by angular support for server side next year.
from typescript.
Related Issues (20)
- Type inference bug with `using` and object literals
- Return type incorrectly inferred as void HOT 5
- .d.ts emitted declarations should not include local variable names from parameter destructuring HOT 2
- [regression - 5.4] Generated `.d.ts` file contains invalid types HOT 6
- The initialization order of the Class Accessor Decorator has been changed. HOT 2
- Allow Infinity, -Infinity and NaN as an enum key name for string enum HOT 3
- Consistent rules naming HOT 10
- `void | T` allows narrowing of `undefined | T` HOT 7
- Design Meeting Notes, 3/19/2024 HOT 4
- JS IntelliSense doesn't show members if class inherits from multiple types HOT 9
- [nightly][regression] Mapped type over generic key unexpectedly makes key treated as optional HOT 6
- 5.4 omits certain `import * as ...` statements from .d.ts HOT 4
- regression in 5.4: error TS2604: JSX element type 'Cmp' does not have any construct or call signatures. HOT 9
- "Expression produces a union type that is too complex to represent" when using interfaces with large number of params for filtering and narrowing down certain keys HOT 4
- Regression 5.4: the new conditional type constraint is not working with a type parameter representing union type HOT 5
- Improve error position/range for arrow functions with expression body HOT 4
- The type of the return value is omitted. HOT 5
- Improve comparable relation of template literal types to detect more impossible situations HOT 5
- NoInfer and overloaded function argument inference HOT 3
- `ReadableStream` is not a subtype of `AsyncIterator` HOT 4
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 typescript.