Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8036,6 +8036,8 @@ TypeScript:
- deno
- ts-node
- tsx
- node
- nodejs
extensions:
- ".ts"
- ".cts"
Expand Down
10 changes: 10 additions & 0 deletions test/test_strategies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,14 @@ def test_xml
assert_xml "test/fixtures/XML/app.config"
assert_xml "test/fixtures/XML/AssertionIDRequestOptionalAttributes.xml.svn-base"
end

def test_shebang_typescript_with_node
ts_node = Blob.new("script.ts", "#!/usr/bin/env node\nconsole.log('hi')")
ts_nodejs = Blob.new("script.ts", "#!/usr/bin/env nodejs\nconsole.log('hi')")
js_node = Blob.new("script.js", "#!/usr/bin/env node\nconsole.log('hi')")

assert_equal Language["TypeScript"], Linguist.detect(ts_node)
assert_equal Language["TypeScript"], Linguist.detect(ts_nodejs)
assert_equal Language["JavaScript"], Linguist.detect(js_node)
end
end