Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TypeScript 'use strict'
Message
De
14/11/2014 11:55:30
 
 
À
14/11/2014 11:46:49
John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01610964
Message ID:
01610998
Vues:
17
>>>>>>I'm using Typescript with angularjs and this has been bugging me for a while (I must be missing something simple).
>>>>>>
>>>>>>If I use:
module SomeModule{
>>>>>>}
TsLint complains with "missing 'use strict'". But if I use:
module SomeModule{
>>>>>>"use strict";
>>>>>>}
it complains with 'expected an assignment or function call'. Why am I in this Catch22 situation ?
>>>>>
>>>>>
>>>>>Isn't it:
>>>>>
>>>>>
>>>>>"Use Strict";
>>>>>module SomeModule{}
>>>>>
Do you mean 'Use Strict' with proper casing (I assume not) or that the directive should be outside the module ?
>>>>If the latter then, no, placing it as the first line inside the module should be valid - at least everything I've read says so....
>>>
>>>I checked some of the code I have and it's outside the module declaration.
>>
>>Hmm. If I place it before the module I get "missing 'use strict' .
>
>Don't know if this applies or not, but apparently there is a little bug in typescript: http://typescript.codeplex.com/workitem/98

That goes back to 2012 and is marked as fixed. FWIW the javascript generated by my original example looks like:
var SomeModule;
(function (SomeModule){
    "use strict";
    //etc
What does yours look like if you place 'use strict' before the module ?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform