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

option to control allowed source version with newer TS version #7573

Closed
alexeagle opened this issue Mar 17, 2016 · 2 comments
Closed

option to control allowed source version with newer TS version #7573

alexeagle opened this issue Mar 17, 2016 · 2 comments
Labels
Suggestion An idea for TypeScript Too Complex An issue which adding support for may be too complex for the value it adds

Comments

@alexeagle
Copy link
Contributor

javac has the -source option. from https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javac.html:

source release
Specifies the version of source code accepted. The following values for release are allowed:

1.3
The compiler does not support assertions, generics, or other language features introduced after Java SE 1.3.

1.4
The compiler accepts code containing assertions, which were introduced in Java SE 1.4.

...

The use case is when a team wants to take advantage of bugfixes or features in the compiler, without committing to upgrade all their other tooling to understand new syntax or semantics.

For example, if I want to use @vladima pathMapping semantics, my users can start using the readonly modifier because it's also in the same version of TypeScript, now my other tooling fails because it uses TS 1.8

@alexeagle
Copy link
Contributor Author

javac also has a -target option, which controls the language level of the emitted bytecode, allowing library authors to avoid breaking their users who are not on the latest version of the language.

alexeagle added a commit to alexeagle/angular that referenced this issue Apr 10, 2016
To workaround microsoft/TypeScript#7573
we must remove the readonly keyword from generated .d.ts files.
This solution will not scale, but will probably buy enough time to require our users move to a 2.0 beta.
alexeagle added a commit to alexeagle/angular that referenced this issue Apr 10, 2016
To workaround microsoft/TypeScript#7573
we must remove the readonly keyword from generated .d.ts files.
This solution will not scale, but will probably buy enough time to require our users move to a 2.0 beta.
alexeagle added a commit to alexeagle/angular that referenced this issue Apr 10, 2016
To workaround microsoft/TypeScript#7573
we must remove the readonly keyword from generated .d.ts files.
This solution will not scale, but will probably buy enough time to require our users move to a 2.0 beta.
alexeagle added a commit to alexeagle/angular that referenced this issue Apr 12, 2016
To workaround microsoft/TypeScript#7573
we must remove the readonly keyword from generated .d.ts files.
This solution will not scale, but will probably buy enough time to require our users move to a 2.0 beta.
alexeagle added a commit to alexeagle/angular that referenced this issue Apr 12, 2016
To workaround microsoft/TypeScript#7573
we must remove the readonly keyword from generated .d.ts files.
This solution will not scale, but will probably buy enough time to require our users move to a 2.0 beta.
alexeagle added a commit to alexeagle/angular that referenced this issue Apr 12, 2016
To workaround microsoft/TypeScript#7573
we must remove the readonly keyword from generated .d.ts files.
This solution will not scale, but will probably buy enough time to require our users move to a 2.0 beta.
alexeagle added a commit to alexeagle/angular that referenced this issue Apr 12, 2016
To workaround microsoft/TypeScript#7573
we must remove the readonly keyword from generated .d.ts files.
This solution will not scale, but will probably buy enough time to require our users move to a 2.0 beta.
alexeagle added a commit to alexeagle/angular that referenced this issue Apr 12, 2016
To workaround microsoft/TypeScript#7573
we must remove the readonly keyword from generated .d.ts files.
This solution will not scale, but will probably buy enough time to require our users move to a 2.0 beta.
mhevery pushed a commit to angular/angular that referenced this issue Apr 13, 2016
To workaround microsoft/TypeScript#7573
we must remove the readonly keyword from generated .d.ts files.
This solution will not scale, but will probably buy enough time to require our users move to a 2.0 beta.

Closes #8003
@mhegazy
Copy link
Contributor

mhegazy commented May 17, 2016

Where as limiting the syntax to a certain set is doable, the semantics are not. Freezing the syntax but adopting new semantics still does not guarantee that the code (or generated declarations) will behave the same way on older tool sets. for instance a change to the overload resolution or inference rules can change types of variables, generate/not generate errors, and generate different definition files. moreover, the same syntax in TS 1.7 (specialized signatures) was used in TS 1.8 to mean a different construct, (string literal types) with different semantics and slightly different overload resolution logic.
Having said that, we do not think we are at a point where we can make a commitment about freezing semantics, nor can we afford to keep trigger different semantic paths based on a flag.
As noted in #6702 (comment), we will be cognisant in the future about what changes that can pop up in the definition files even if the source did not include them, to give users an easier migration path.

@mhegazy mhegazy closed this as completed May 17, 2016
@mhegazy mhegazy added Too Complex An issue which adding support for may be too complex for the value it adds and removed In Discussion Not yet reached consensus labels May 17, 2016
@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
Suggestion An idea for TypeScript Too Complex An issue which adding support for may be too complex for the value it adds
Projects
None yet
Development

No branches or pull requests

2 participants