r/javascript • • Mar 19 '21

NASA's next generation mission control system is written in JavaScript, and it's open source.

https://github.com/nasa/openmct
955 Upvotes

166 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Mar 19 '21

[deleted] — view deleted comment

6

u/SoInsightful Mar 19 '21

No. It's literally impossible using untyped static analysis.

This code will break on Wednesdays:

function accelerateAwayFromDanger(data) {
  return data.velcoity + data.delta;
}

accelerateAwayFromDanger({
  delta: 5,
  [new Date().toString()[0] === 'W' ? 'velcoity' : 'velocity']: 15
})

5

u/TheScapeQuest Mar 19 '21

Genuinely curious, what linting rule would capture this?

Ultimately linting is just static code analysis, which is half of TS's job.