10

The question is pretty straight forward. I'm seen some questions that have both and and I'm not sure if I should edit to only or leave both.

For example, my edit on this question.

9
  • 1
  • 1
  • 3
    Well, in this case you edited out the javascript tag and left the typescript tag. Are you sure the question is specifically about typescript? It's a question about lambdas, that's a core Javascript feature, not really specific to Typescript.
    – Gimby
    May 10, 2019 at 12:34
  • The question isn't specifically about typescript, but he is using it with other libraries
    – Vencovsky
    May 10, 2019 at 12:38
  • 3
    Considering the title still has "javascript / typescript" at the end of it, and it was obviously the intent of the author to gather views from both JavaScript and TypeScript followers, no, you should not edit out the tag. May 10, 2019 at 13:00
  • 4
    Additionally, many, many questions that are tagged TypeScript can be answered with JavaScript, since TypeScript is essentially a superset of JavaScript, so you do want both unless the question is solely about TypeScript semantics/transpilation/etc. May 10, 2019 at 13:02
  • 1
    @Vencovsky what is used isn't really all that relevant, tags are dictated by what a question is about.
    – Gimby
    May 10, 2019 at 14:39
  • In what way does removing the javascript tag benefit the question? If it doesn't, then it should probably stay. If it does, say, by directing it to the correct audience, then it the tag should probably go.
    – VLAZ
    May 12, 2019 at 16:35
  • 1
    I'm not sure if I should edit to only typescript or leave both. Then don't do anything!
    – TaW
    May 13, 2019 at 5:58

3 Answers 3

6

The wrong tag on this question is TypeScript, not JavaScript. Let me cite the rejection reason for irrelevant tags:

This edit introduces tags that do not help to define the topic of the question. Tags should help to describe what the question is about, not just what it contains.

The question is about a common problem in JavaScript, scoping of lambda functions. It has exactly nothing specific to TypeScript, it just contains TypeScript.

8
  • 3
    @window.document only Siths deal in absolute. There may be questions that deal with interactions between javascript and typescript code for which knowledge about both is required.
    – Braiam
    May 12, 2019 at 14:36
  • Be it any scoping issue or exception, @Braiam We should tag the question for the language of the code given by the OP. Be it any subset of any language. That's what, the tags are for. What if that scoping issue is also an issue for another language and the solution is also same?
    – weegee
    May 12, 2019 at 17:47
  • 1
    @window.document that's to the one that knows javascript knowledge to decide. If you know confidently that you are out in the weeds with a question tagged javascript, you can confidently remove the javascript tag. The knowledge set you have don't even allow you to solve part of the problem or understand it, why allow others that know javascript to lose their time wondering so.
    – Braiam
    May 12, 2019 at 20:08
  • In other words, answering the question "is my knowledge required to understand this problem?" would help you to decide whenver or not remove the tag.
    – Braiam
    May 12, 2019 at 20:12
  • 1
    Disagree. Ish. The OP should have abstracted the TypeScript away, to produce only JavaScript, as that's where the problem lies. They didn't so both tags are kinda appropriate. I'd hope an editor (or the OP) would fix that lest the question be closed as not an MCVE May 12, 2019 at 23:22
  • I partially agree. TypeScript, when transpiled to ES5, can have quirks that are not evident in more recent versions of ECMAScript. Removing the typescript tag might lead to misunderstandings, as a behavior that works in ES6+ might not function correctly in TypeScript after transpilation to ES5.. May 14, 2019 at 15:36
  • sure @HereticMonkey, there might be things that depend on both tags. There are also cases where that is not the case, such as that question. I'm totally not saying we should always remove TS, or JS, but that it's a judgement call that should be made with experience with both technologies at hand, and in the absence of such experience, that both should be left there. May 14, 2019 at 15:39
  • At the very least, no rule of thumb like "TypeScript is a superset of JavaScript hence we should remove JavaScript" should be upheld :) May 14, 2019 at 15:41
5

The title of the linked question itself asks for either JavaScript or TypeScript, so it seems the author's intent was clear in wanting answers in either language. Considering the languages' similarities, this is not surprising. Many people who are fluent in TypeScript can mentally convert JavaScript to TypeScript.

Indeed TypeScript can be considered a superset of JavaScript. A JavaScript file, if written with "use strict;", is a valid TypeScript file.

Thus, if a question is about, say, Angular (frequently written in TypeScript), an answer written in JavaScript will still function in a TypeScript file. There may be some type information that would be helpful if added, but that is generally minor and easily edited in.

All that said, questions regarding specific syntax, constructs, or compilation/transpilation configuration, available only in TypeScript, should not include the tag.

While it is unwise to add to all questions tagged , I don't believe removing the tag from questions also tagged is a good idea either. Leave those alone.

0
0

I don't think you should include when on questions about TypeScript because:

  1. It will be redundant, as TypeScript is for JavaScript, if one should see a TypeScript tag then they should eventually figure out that the programming language, the question is based on.

  2. Also, if I know JavaScript but I'm not familiar with TypeScript, and I'm watching the JavaScript tag, then when a TypeScript question appears in my feed then I won't be able to answer it.

I think the tag is enough to tell about the language of the question.

The tag description also says:

TypeScript is a typed superset of JavaScript

Even though, we can use javascript within typescript, that will never be an user's intent. What we can do is to tag questions only with by which, the question will gain the most relevant answers.

13
  • Some people say that they can answer TypeScript even if they only know JavaScript and others daily that can't...
    – Vencovsky
    May 11, 2019 at 15:20
  • 3
    If they can answer both of them then they can watch both of the tags. Tags are not meant to group questions but to tell about the questions. @Vencovsky
    – weegee
    May 11, 2019 at 15:21
  • 1
    You can add javascript to your favorite tags and add typescript to your ignored tags, easily alleviating yourself of the burden of seeing TypeScript questions also tagged javascript. It is not redundant, just as having javascript on a jquery question is not redundant. May 11, 2019 at 21:15
  • 1
    jQuery is a library written in JavaScript. As is lodast, and underscore and many others. Yet people typically tag question with javascript and the library, even though the library itself already implies what the language is. Thus, I find this reasoning flawed.
    – VLAZ
    May 12, 2019 at 16:21
  • even though the library itself already implies what the language is. That's what I mentioned in my question, that "the tag typescript is enough to tell about the language of the question." @VLAZ Can you tell which part of the reasoning you find as flawed?
    – weegee
    May 12, 2019 at 17:21
  • 1
    @window.document you say that typescript already implies javascript, hence javascript does not need to be tagged. However, jquery also implies javascript and we still routinely tag both. Same with lodash, same with underscore, and more. Hence why I find the reasoning of "implied language" flawed.
    – VLAZ
    May 12, 2019 at 17:26
  • @VLAZ because jQuery is written in javascript and is same as js but it just puts a layer which we can use for shorter and easier js, whereas typescript changes the whole syntax for js, so comparison above in your previous comment doesn't fits
    – weegee
    May 12, 2019 at 17:33
  • @VLAZ What if i was ignoring the typescript tag? I will miss on questions that contains some js which I can contribute my help to?
    – weegee
    May 12, 2019 at 17:39
  • JavaScript code is valid TypeScript code. And I only follow the JS yet I've been able to answer TS questions even though I've almost no first hand experience with the language. You can skip TS questions but I find that for most of them TS matters little, as it's usually some JS issue at the core. In fact, I only have two TS answers only because I dupe vote the rest or because somebody was faster in answering, not because it's impossible to answer those.
    – VLAZ
    May 12, 2019 at 18:03
  • @VLAZ yes js code is valid TypeScript code, just like someone experienced in C, can answer C++ questions very easily but that doesn't mean that we should tag the question indifferent of the language, the OP asks about. If you can answer typescript questions as you state so, then you should watch the typescript tag. You'll get more questions, strongly based on typescript and answering them will grow your typescript knowledge Which is what I mean.
    – weegee
    May 12, 2019 at 18:08
  • But I don't want to watch the TS tag. I can answer the question but that doesn't mean I am drawn to do it. I watch the JS tag and answer questions there. There are TS questions that only require TS knowledge - if they are correctly tagged as TS only, then I'm not really interested in them. Those questions would be about the compilation or configuration of TS, though. But if the question is about code, I don't mind. After all, JS code is TS code. This is why I find it illogical that TS questions should only be tagged TS, not JS if code in both would be valid.
    – VLAZ
    May 12, 2019 at 18:14
  • 1
    @VLAZ your assessment above renders typescript as useless. What do you mean by After all, JS code is TS code. I strongly disagree with that. You cannot run typescript code in a javascript file. One uses typescript because They want to use it not to run javascript in .ts file
    – weegee
    May 12, 2019 at 18:20
  • 1
    "You cannot run typescript code in a javascript file." that's because TypeScript code is not necessarily JavaScript code. What I said is that JavaScript code is TypeScript code. And that is correct. The same way all dogs are animals but not all animals are dogs. I also disagree with your assertion that people write TypeScript because they don't want JS. I would say there would be many reasons but the primary motivation is to write JavaScript code with added type safety. If somebody writes a for...of loop in TS, that doesn't mean JS knowledge won't help.
    – VLAZ
    May 12, 2019 at 18:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .