@systemfsoftware/stryker-js-typescript-checker 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/.turbo/turbo-build.log +15 -0
  2. package/.turbo/turbo-lint.log +3 -0
  3. package/LICENSE +21 -0
  4. package/dist/index.d.mts +122 -0
  5. package/dist/index.mjs +602 -0
  6. package/oxlint.config.ts +9 -0
  7. package/package.json +37 -0
  8. package/schema/typescript-checker-options.json +22 -0
  9. package/src/fs/hybrid-file-system.ts +118 -0
  10. package/src/fs/index.ts +2 -0
  11. package/src/fs/script-file.ts +44 -0
  12. package/src/grouping/create-groups.ts +77 -0
  13. package/src/grouping/ts-file-node.ts +54 -0
  14. package/src/index.ts +18 -0
  15. package/src/plugin-tokens.ts +2 -0
  16. package/src/tsconfig-helpers.ts +168 -0
  17. package/src/typescript-checker-options-with-stryker-options.ts +9 -0
  18. package/src/typescript-checker.ts +223 -0
  19. package/src/typescript-compiler.ts +406 -0
  20. package/test/integration/e2e-plugin-entry.it.spec.ts +153 -0
  21. package/test/integration/project-references.it.spec.ts +146 -0
  22. package/test/integration/project-with-ts-buildinfo.it.spec.ts +92 -0
  23. package/test/integration/single-project.it.spec.ts +263 -0
  24. package/test/integration/typescript-checkers-errors.it.spec.ts +87 -0
  25. package/test/unit/fs/hybrid-file-system.spec.ts +109 -0
  26. package/test/unit/grouping/create-groups.spec.ts +122 -0
  27. package/test/unit/grouping/ts-file-node.spec.ts +132 -0
  28. package/testResources/errors/compile-error/add.ts +3 -0
  29. package/testResources/errors/compile-error/tsconfig.json +6 -0
  30. package/testResources/errors/empty-dir/.gitkeep +0 -0
  31. package/testResources/errors/invalid-tsconfig/tsconfig.json +1 -0
  32. package/testResources/project-references/src/index.ts +5 -0
  33. package/testResources/project-references/src/job.ts +6 -0
  34. package/testResources/project-references/src/src.tsbuildinfo +1 -0
  35. package/testResources/project-references/src/tsconfig.json +10 -0
  36. package/testResources/project-references/tsconfig.root.json +7 -0
  37. package/testResources/project-references/tsconfig.settings.json +17 -0
  38. package/testResources/project-references/utils/math.ts +3 -0
  39. package/testResources/project-references/utils/text.ts +3 -0
  40. package/testResources/project-references/utils/tsconfig.json +7 -0
  41. package/testResources/project-references/utils/utils.tsbuildinfo +1 -0
  42. package/testResources/project-with-ts-buildinfo/do-not-delete.tsbuildinfo +1 -0
  43. package/testResources/project-with-ts-buildinfo/src/index.ts +3 -0
  44. package/testResources/project-with-ts-buildinfo/tsconfig.json +17 -0
  45. package/testResources/single-project/src/counter.ts +9 -0
  46. package/testResources/single-project/src/errorInFileAbove2Mutants/counter.ts +9 -0
  47. package/testResources/single-project/src/errorInFileAbove2Mutants/todo-counter.ts +7 -0
  48. package/testResources/single-project/src/errorInFileAbove2Mutants/todo.spec.ts +11 -0
  49. package/testResources/single-project/src/errorInFileAbove2Mutants/todo.ts +22 -0
  50. package/testResources/single-project/src/not-type-checked.js +1 -0
  51. package/testResources/single-project/src/todo.spec.ts +11 -0
  52. package/testResources/single-project/src/todo.ts +22 -0
  53. package/testResources/single-project/tsconfig.json +15 -0
  54. package/tsconfig.json +10 -0
  55. package/vitest.config.ts +11 -0
@@ -0,0 +1,87 @@
1
+ import path from 'path'
2
+ import { fileURLToPath } from 'url'
3
+
4
+ import type { StrykerOptions } from '@stryker-mutator/api/core'
5
+ import type { Logger } from '@stryker-mutator/api/logging'
6
+ import { describe, expect, it } from 'vitest'
7
+
8
+ import { HybridFileSystem } from '../../src/fs/hybrid-file-system.js'
9
+ import { TypescriptChecker } from '../../src/typescript-checker.js'
10
+ import { TypescriptCompiler } from '../../src/typescript-compiler.js'
11
+
12
+ const resolveTestResource = path.resolve.bind(
13
+ path,
14
+ path.dirname(fileURLToPath(import.meta.url)),
15
+ '..',
16
+ '..',
17
+ 'testResources',
18
+ 'errors',
19
+ ) as unknown as typeof path.resolve
20
+
21
+ function createLogger(): Logger {
22
+ return {
23
+ isTraceEnabled: () => false,
24
+ isDebugEnabled: () => false,
25
+ isInfoEnabled: () => false,
26
+ isWarnEnabled: () => false,
27
+ isErrorEnabled: () => false,
28
+ isFatalEnabled: () => false,
29
+ trace: () => {},
30
+ debug: () => {},
31
+ info: () => {},
32
+ warn: () => {},
33
+ error: () => {},
34
+ fatal: () => {},
35
+ }
36
+ }
37
+
38
+ function createChecker(tsconfigFile: string): TypescriptChecker {
39
+ const options = {
40
+ tsconfigFile,
41
+ typescriptChecker: { prioritizePerformanceOverAccuracy: true },
42
+ } as unknown as StrykerOptions
43
+ const logger = createLogger()
44
+ const fileSystem = new HybridFileSystem()
45
+ const compiler = new TypescriptCompiler(logger, options, fileSystem)
46
+ return new TypescriptChecker(logger, options, compiler)
47
+ }
48
+
49
+ describe('Typescript checker errors', () => {
50
+ it('should reject initialization if initial compilation failed', async () => {
51
+ const sut = createChecker(
52
+ resolveTestResource('compile-error', 'tsconfig.json'),
53
+ )
54
+ await expect(sut.init()).rejects.toThrow(
55
+ 'Typescript error(s) found in dry run compilation:',
56
+ )
57
+ await expect(sut.init()).rejects.toThrow(
58
+ 'testResources/errors/compile-error/add.ts(2,3): error TS2322:',
59
+ )
60
+ })
61
+
62
+ it('should reject initialization if tsconfig was invalid', async () => {
63
+ const sut = createChecker(
64
+ resolveTestResource('invalid-tsconfig', 'tsconfig.json'),
65
+ )
66
+ await expect(sut.init()).rejects.toThrow(
67
+ 'Typescript error(s) found in dry run compilation:',
68
+ )
69
+ await expect(sut.init()).rejects.toThrow(
70
+ 'testResources/errors/invalid-tsconfig/tsconfig.json(1,1): error TS1005:',
71
+ )
72
+ })
73
+
74
+ it("should reject when tsconfig file doesn't exist", async () => {
75
+ const sut = createChecker(
76
+ resolveTestResource('empty-dir', 'tsconfig.json'),
77
+ )
78
+ await expect(sut.init()).rejects.toThrow(
79
+ `The tsconfig file does not exist at: "${
80
+ resolveTestResource(
81
+ 'empty-dir',
82
+ 'tsconfig.json',
83
+ )
84
+ }". Please configure the tsconfig file in your stryker.conf file using "tsconfigFile"`,
85
+ )
86
+ })
87
+ })
@@ -0,0 +1,109 @@
1
+ import { describe, expect, it } from 'vitest'
2
+
3
+ import { HybridFileSystem } from '../../../src/fs/hybrid-file-system.js'
4
+
5
+ describe('HybridFileSystem', () => {
6
+ function createSut(): HybridFileSystem {
7
+ return new HybridFileSystem()
8
+ }
9
+
10
+ describe('writeFile', () => {
11
+ it('should create a new in-memory file', () => {
12
+ const sut = createSut()
13
+ sut.writeFile('add.js', 'a + b')
14
+ const file = sut.getFile('add.js')
15
+ expect(file).toBeTruthy()
16
+ expect(file!.content).toBe('a + b')
17
+ expect(file!.fileName).toBe('add.js')
18
+ })
19
+
20
+ it('should override an existing file', () => {
21
+ const sut = createSut()
22
+ sut.writeFile('add.js', 'a + b')
23
+ sut.writeFile('add.js', 'a - b')
24
+ const file = sut.getFile('add.js')
25
+ expect(file!.content).toBe('a - b')
26
+ })
27
+
28
+ it('should convert path separator to forward slashes', () => {
29
+ const sut = createSut()
30
+ sut.writeFile('test\\foo\\a.js', 'a')
31
+ const actual = sut.getFile('test/foo/a.js')
32
+ expect(actual).toBeTruthy()
33
+ expect(actual!.content).toBe('a')
34
+ })
35
+ })
36
+
37
+ describe('readFile', () => {
38
+ it('should return in-memory content', () => {
39
+ const sut = createSut()
40
+ sut.writeFile('foo.js', 'in-memory')
41
+ expect(sut.readFile('foo.js')).toBe('in-memory')
42
+ })
43
+
44
+ it('should return undefined for non-mutated files to allow disk fallback', () => {
45
+ const sut = createSut()
46
+ expect(sut.readFile('some-file-that-is-not-tracked.js')).toBeUndefined()
47
+ })
48
+
49
+ it('should return null for buildinfo files', () => {
50
+ const sut = createSut()
51
+ expect(sut.readFile('cache.tsbuildinfo')).toBeNull()
52
+ })
53
+
54
+ it('should return the tsconfig override when present', () => {
55
+ const sut = createSut()
56
+ sut.tsConfigOverrides.set('/project/tsconfig.json', '{"compilerOptions":{}}')
57
+ expect(sut.readFile('/project/tsconfig.json')).toBe('{"compilerOptions":{}}')
58
+ })
59
+ })
60
+
61
+ describe('fileExists', () => {
62
+ it('should return true for in-memory files', () => {
63
+ const sut = createSut()
64
+ sut.writeFile('foo.js', '')
65
+ expect(sut.fileExists('foo.js')).toBe(true)
66
+ })
67
+
68
+ it('should return false for buildinfo files', () => {
69
+ const sut = createSut()
70
+ expect(sut.fileExists('cache.tsbuildinfo')).toBe(false)
71
+ })
72
+
73
+ it('should return undefined for unknown files', () => {
74
+ const sut = createSut()
75
+ expect(sut.fileExists('unknown.js')).toBeUndefined()
76
+ })
77
+ })
78
+
79
+ describe('mutateFile / resetFile', () => {
80
+ it('should mutate a file and reset it afterwards', () => {
81
+ const sut = createSut()
82
+ sut.writeFile('add.js', 'function add(a: number, b: number) { return a + b; }')
83
+ sut.mutateFile('add.js', {
84
+ location: {
85
+ start: { line: 0, column: 42 },
86
+ end: { line: 0, column: 49 },
87
+ },
88
+ replacement: 'a - b',
89
+ })
90
+ expect(sut.readFile('add.js')).toContain('a - b')
91
+
92
+ sut.resetFile('add.js')
93
+ expect(sut.readFile('add.js')).toContain('a + b')
94
+ })
95
+ })
96
+
97
+ describe('existsInMemory', () => {
98
+ it('should return true if file exists in memory', () => {
99
+ const sut = createSut()
100
+ sut.writeFile('test-file', '')
101
+ expect(sut.existsInMemory('test-file')).toBe(true)
102
+ })
103
+
104
+ it('should return false if file does not exist in memory', () => {
105
+ const sut = createSut()
106
+ expect(sut.existsInMemory('test-file')).toBe(false)
107
+ })
108
+ })
109
+ })
@@ -0,0 +1,122 @@
1
+ import { describe, expect, it } from 'vitest'
2
+
3
+ import { createGroups } from '../../../src/grouping/create-groups.js'
4
+ import { TSFileNode } from '../../../src/grouping/ts-file-node.js'
5
+
6
+ function factoryMutant(fileName: string, id: string) {
7
+ return {
8
+ id,
9
+ fileName,
10
+ mutatorName: 'foo-mutator',
11
+ replacement: '',
12
+ location: {
13
+ start: { line: 0, column: 0 },
14
+ end: { line: 0, column: 0 },
15
+ },
16
+ }
17
+ }
18
+
19
+ describe('createGroups', () => {
20
+ it('single mutant should create single group', () => {
21
+ const mutants = [factoryMutant('a.js', 'mutant-1')]
22
+ const nodes = new Map<string, TSFileNode>([
23
+ ['a.js', new TSFileNode('a.js', [], [])],
24
+ ])
25
+ const groups = createGroups(mutants, nodes)
26
+ expect(groups).toHaveLength(1)
27
+ expect(groups[0]!).toHaveLength(1)
28
+ expect(groups[0]![0]).toBe('mutant-1')
29
+ })
30
+
31
+ it('two mutants in different files without reference to each other should create single group', () => {
32
+ const mutants = [factoryMutant('a.js', '1'), factoryMutant('b.js', '2')]
33
+ const nodes = new Map<string, TSFileNode>([
34
+ ['a.js', new TSFileNode('a.js', [], [])],
35
+ ['b.js', new TSFileNode('b.js', [], [])],
36
+ ])
37
+ const groups = createGroups(mutants, nodes)
38
+ expect(groups).toHaveLength(1)
39
+ expect(groups[0]![0]).toBe('1')
40
+ expect(groups[0]![1]).toBe('2')
41
+ })
42
+
43
+ it('two mutants in different files with reference to each other should create 2 groups', () => {
44
+ const mutants = [factoryMutant('a.js', '1'), factoryMutant('b.js', '2')]
45
+ const nodeA = new TSFileNode('a.js', [], [])
46
+ const nodeB = new TSFileNode('b.js', [nodeA], [])
47
+ const nodes = new Map<string, TSFileNode>([
48
+ [nodeA.fileName, nodeA],
49
+ [nodeB.fileName, nodeB],
50
+ ])
51
+ const groups = createGroups(mutants, nodes)
52
+ expect(groups).toHaveLength(2)
53
+ expect(groups[0]![0]).toBe('1')
54
+ expect(groups[1]![0]).toBe('2')
55
+ })
56
+
57
+ it('two mutants in different files with circular dependency to each other should create 2 groups', () => {
58
+ const mutants = [factoryMutant('a.js', '1'), factoryMutant('b.js', '2')]
59
+ const nodeA = new TSFileNode('a.js', [], [])
60
+ const nodeB = new TSFileNode('b.js', [nodeA], [])
61
+ nodeA.parents.push(nodeB)
62
+ const nodes = new Map<string, TSFileNode>([
63
+ [nodeA.fileName, nodeA],
64
+ [nodeB.fileName, nodeB],
65
+ ])
66
+ const groups = createGroups(mutants, nodes)
67
+ expect(groups).toHaveLength(2)
68
+ expect(groups[0]![0]).toBe('1')
69
+ expect(groups[1]![0]).toBe('2')
70
+ })
71
+
72
+ it('two mutants in same file should create 2 groups', () => {
73
+ const mutants = [factoryMutant('a.js', '1'), factoryMutant('a.js', '2')]
74
+ const nodeA = new TSFileNode('a.js', [], [])
75
+ const nodes = new Map<string, TSFileNode>([[nodeA.fileName, nodeA]])
76
+ const groups = createGroups(mutants, nodes)
77
+ expect(groups).toHaveLength(2)
78
+ expect(groups[0]![0]).toBe('1')
79
+ expect(groups[1]![0]).toBe('2')
80
+ })
81
+
82
+ it('complex graph should contain multiple groups', () => {
83
+ const mutants = [
84
+ factoryMutant('a.js', '1'),
85
+ factoryMutant('b.js', '2'),
86
+ factoryMutant('c.js', '3'),
87
+ factoryMutant('d.js', '4'),
88
+ factoryMutant('e.js', '5'),
89
+ factoryMutant('f.js', '6'),
90
+ ]
91
+ const nodeA = new TSFileNode('a.js', [], [])
92
+ const nodeB = new TSFileNode('b.js', [nodeA], [])
93
+ const nodeC = new TSFileNode('c.js', [nodeA], [])
94
+ const nodeD = new TSFileNode('d.js', [nodeC], [])
95
+ const nodeE = new TSFileNode('e.js', [nodeA], [])
96
+ const nodeF = new TSFileNode('f.js', [nodeE, nodeD], [])
97
+ const nodes = new Map<string, TSFileNode>([
98
+ [nodeA.fileName, nodeA],
99
+ [nodeB.fileName, nodeB],
100
+ [nodeC.fileName, nodeC],
101
+ [nodeD.fileName, nodeD],
102
+ [nodeE.fileName, nodeE],
103
+ [nodeF.fileName, nodeF],
104
+ ])
105
+ const groups = createGroups(mutants, nodes)
106
+ expect(groups).toHaveLength(4)
107
+ expect(groups[0]![0]).toBe('1')
108
+ expect(groups[1]![0]).toBe('2')
109
+ expect(groups[1]![1]).toBe('3')
110
+ expect(groups[1]![2]).toBe('5')
111
+ expect(groups[2]![0]).toBe('4')
112
+ expect(groups[3]![0]).toBe('6')
113
+ })
114
+
115
+ it('should throw error when node is not in graph', () => {
116
+ const mutants = [factoryMutant('a.js', '1')]
117
+ const nodeA = new TSFileNode('.js', [], [])
118
+ const nodes = new Map<string, TSFileNode>([[nodeA.fileName, nodeA]])
119
+
120
+ expect(() => createGroups(mutants, nodes)).toThrow('Node not in graph: a.js')
121
+ })
122
+ })
@@ -0,0 +1,132 @@
1
+ import { describe, expect, it } from 'vitest'
2
+
3
+ import { TSFileNode } from '../../../src/grouping/ts-file-node.js'
4
+
5
+ describe('TSFileNode', () => {
6
+ describe('getAllParentReferencesIncludingSelf', () => {
7
+ it('without parent should return array of 1 node', () => {
8
+ const node = new TSFileNode('NodeA', [], [])
9
+ expect(node.getAllParentReferencesIncludingSelf()).toHaveLength(1)
10
+ })
11
+
12
+ it('with 1 parent should return array of 2 nodes', () => {
13
+ const node = new TSFileNode('NodeA', [new TSFileNode('', [], [])], [])
14
+ expect(node.getAllParentReferencesIncludingSelf()).toHaveLength(2)
15
+ })
16
+
17
+ it('with recursive depth of 2 should return 3 nodes', () => {
18
+ const node = new TSFileNode(
19
+ 'NodeA',
20
+ [new TSFileNode('', [new TSFileNode('', [], [])], [])],
21
+ [],
22
+ )
23
+ expect(node.getAllParentReferencesIncludingSelf()).toHaveLength(3)
24
+ })
25
+
26
+ it('with recursive depth of 2 and multiple parents should return 4 nodes', () => {
27
+ const node = new TSFileNode(
28
+ 'NodeA',
29
+ [
30
+ new TSFileNode(
31
+ '',
32
+ [new TSFileNode('', [], []), new TSFileNode('', [], [])],
33
+ [],
34
+ ),
35
+ ],
36
+ [],
37
+ )
38
+ expect(node.getAllParentReferencesIncludingSelf()).toHaveLength(4)
39
+ })
40
+
41
+ it('with circular dependency should skip circular dependency node', () => {
42
+ const nodeA = new TSFileNode('NodeA', [], [])
43
+ const nodeC = new TSFileNode('NodeB', [nodeA], [])
44
+ const nodeB = new TSFileNode('NodeB', [nodeC], [])
45
+ nodeA.parents.push(nodeB)
46
+ expect(nodeA.getAllParentReferencesIncludingSelf()).toHaveLength(3)
47
+ })
48
+ })
49
+
50
+ describe('getAllChildReferencesIncludingSelf', () => {
51
+ it('without child should return array of 1 node', () => {
52
+ const node = new TSFileNode('NodeA', [], [])
53
+ expect(node.getAllChildReferencesIncludingSelf()).toHaveLength(1)
54
+ })
55
+
56
+ it('with 1 child should return array of 2 nodes', () => {
57
+ const node = new TSFileNode('NodeA', [], [new TSFileNode('', [], [])])
58
+ expect(node.getAllChildReferencesIncludingSelf()).toHaveLength(2)
59
+ })
60
+
61
+ it('with recursive depth of 2 should return 3 nodes', () => {
62
+ const node = new TSFileNode(
63
+ 'NodeA',
64
+ [],
65
+ [new TSFileNode('', [], [new TSFileNode('', [], [])])],
66
+ )
67
+ expect(node.getAllChildReferencesIncludingSelf()).toHaveLength(3)
68
+ })
69
+
70
+ it('with recursive depth of 2 and multiple children should return 4 nodes', () => {
71
+ const node = new TSFileNode(
72
+ 'NodeA',
73
+ [],
74
+ [
75
+ new TSFileNode(
76
+ '',
77
+ [],
78
+ [new TSFileNode('', [], []), new TSFileNode('', [], [])],
79
+ ),
80
+ ],
81
+ )
82
+ expect(node.getAllChildReferencesIncludingSelf()).toHaveLength(4)
83
+ })
84
+ })
85
+
86
+ describe('getMutantsWithReferenceToChildrenOrSelf', () => {
87
+ it('with single mutant in file should return 1 mutant', () => {
88
+ const node = new TSFileNode('NodeA.js', [], [])
89
+ const mutants = [createMutant('NodeA.js')]
90
+ expect(node.getMutantsWithReferenceToChildrenOrSelf(mutants)).toHaveLength(1)
91
+ })
92
+
93
+ it('with single mutant in child should return 1 mutant', () => {
94
+ const node = new TSFileNode('NodeA.js', [], [])
95
+ const nodeB = new TSFileNode('NodeB.js', [], [])
96
+ node.children.push(nodeB)
97
+ const mutants = [createMutant('NodeB.js')]
98
+ expect(node.getMutantsWithReferenceToChildrenOrSelf(mutants)).toHaveLength(1)
99
+ })
100
+
101
+ it('should not create endless loop', () => {
102
+ const node = new TSFileNode('NodeA.js', [], [])
103
+ node.children = [node]
104
+
105
+ const mutants = [createMutant('NodeA.js')]
106
+
107
+ expect(node.getMutantsWithReferenceToChildrenOrSelf(mutants)).toHaveLength(1)
108
+ })
109
+
110
+ it('should find mutant with backward slashes and forward slashes', () => {
111
+ const node = new TSFileNode('path/NodeA.js', [], [])
112
+ node.children = [node]
113
+
114
+ const mutants = [createMutant('path/NodeA.js'), createMutant('path\\NodeA.js')]
115
+
116
+ expect(node.getMutantsWithReferenceToChildrenOrSelf(mutants)).toHaveLength(2)
117
+ })
118
+ })
119
+ })
120
+
121
+ function createMutant(fileName: string) {
122
+ return {
123
+ fileName,
124
+ id: '0',
125
+ replacement: '-',
126
+ location: {
127
+ start: { line: 1, column: 1 },
128
+ end: { line: 1, column: 1 },
129
+ },
130
+ mutatorName: '',
131
+ }
132
+ }
@@ -0,0 +1,3 @@
1
+ function add(a: number, b: number): string {
2
+ return a + b
3
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES5",
4
+ "types": []
5
+ }
6
+ }
File without changes
@@ -0,0 +1 @@
1
+ invalid tsconfig file
@@ -0,0 +1,5 @@
1
+ import { count } from '../utils/math.js'
2
+
3
+ export function countArrayLength(todo: any[]): number {
4
+ return count(todo)
5
+ }
@@ -0,0 +1,6 @@
1
+ import { toUpperCase } from '../utils/text.js'
2
+
3
+ export function start(): void {
4
+ const logText = 'Starting job'
5
+ console.log(toUpperCase(logText))
6
+ }
@@ -0,0 +1 @@
1
+ {"program":{"fileNames":["../../../../../node_modules/typescript/lib/lib.d.ts","../../../../../node_modules/typescript/lib/lib.es5.d.ts","../../../../../node_modules/typescript/lib/lib.dom.d.ts","../../../../../node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../../../node_modules/typescript/lib/lib.scripthost.d.ts","../dist/utils/math.d.ts","./index.ts","../dist/utils/text.d.ts","./job.ts"],"fileInfos":["2dc8c927c9c162a773c6bb3cdc4f3286c23f10eedc67414028f9cb5951610f60",{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"7fac8cb5fc820bc2a59ae11ef1c5b38d3832c6d0dfaec5acdb5569137d09a481","affectsGlobalScope":true},{"version":"097a57355ded99c68e6df1b738990448e0bf170e606707df5a7c0481ff2427cd","affectsGlobalScope":true},"80dbf481ae698a44d6d4b60f3c36d84a94b2a5eb14927eae5347b82f33ec0277",{"version":"c9b6bdd48b8bdb8d8e7690c7cc18897a494b6ab17dc58083dacfaf14b846ab4f","signature":"40b6409b8d0dced1f6c3964012b7a7c1cd50e24c3242095d1c8cfc6cabe8bd31"},"cdf6a65d46d64de68df5d8a322621f74327b1ee02c3fde41f736e11d307fcfb1",{"version":"e4c28c497fe6cc6364b113c181c32ba58e70f02d824295e72b15d9570b403104","signature":"9be66c79f48b4876970daed5167e069d7f12f1a1ca616ecaa0ca8280946344ca"}],"options":{"composite":true,"declaration":true,"declarationMap":true,"module":1,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"../dist/src","strict":true,"target":1,"tsBuildInfoFile":"./src.tsbuildinfo"},"fileIdsList":[[6],[8]],"referencedMap":[[7,1],[9,2]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,3,2,5,4,6,8,7,9],"latestChangedDtsFile":"../dist/src/job.d.ts"},"version":"4.8.4"}
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../tsconfig.settings",
3
+ "compilerOptions": {
4
+ "tsBuildInfoFile": "src.tsbuildinfo",
5
+ "outDir": "../dist/src"
6
+ },
7
+ "references": [
8
+ { "path": "../utils" }
9
+ ]
10
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ { "path": "./src" },
5
+ { "path": "./utils" }
6
+ ]
7
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "strict": true,
4
+ "target": "es5",
5
+ "moduleResolution": "node",
6
+ "module": "commonjs",
7
+ "composite": true,
8
+ "declaration": true,
9
+ "declarationMap": true,
10
+
11
+ // These settings should be overridden by the typescript checker
12
+ "noUnusedLocals": true,
13
+ "noUnusedParameters": true,
14
+
15
+ "types": []
16
+ }
17
+ }
@@ -0,0 +1,3 @@
1
+ export function count(array: any[]) {
2
+ return array.length
3
+ }
@@ -0,0 +1,3 @@
1
+ export function toUpperCase(text: string) {
2
+ return text.toUpperCase()
3
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../tsconfig.settings",
3
+ "compilerOptions": {
4
+ "outDir": "../dist/utils",
5
+ "tsBuildInfoFile": "utils.tsbuildinfo"
6
+ }
7
+ }
@@ -0,0 +1 @@
1
+ {"program":{"fileNames":["../../../../../node_modules/typescript/lib/lib.d.ts","../../../../../node_modules/typescript/lib/lib.es5.d.ts","../../../../../node_modules/typescript/lib/lib.dom.d.ts","../../../../../node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../../../node_modules/typescript/lib/lib.scripthost.d.ts","./math.ts","./text.ts"],"fileInfos":["2dc8c927c9c162a773c6bb3cdc4f3286c23f10eedc67414028f9cb5951610f60",{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"7fac8cb5fc820bc2a59ae11ef1c5b38d3832c6d0dfaec5acdb5569137d09a481","affectsGlobalScope":true},{"version":"097a57355ded99c68e6df1b738990448e0bf170e606707df5a7c0481ff2427cd","affectsGlobalScope":true},{"version":"6198e7d4a43aabb174a72ec9f0e8d2962912ad59ad90010aac3930868a8f62a4","signature":"0400cb85cef49e897c47df13e38b5cd199e0c900253f2d2ddf2e3491c27bc0a8"},{"version":"becd081df112726ab94c1ca1c05d6a59268fe0dabf7ad076d16ea851bf99e8fb","signature":"6039d94241358544e8d62a3a0ba90752a9973b3b2b422c187e2bcf7256fcda2e"}],"options":{"composite":true,"declaration":true,"declarationMap":true,"module":1,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"../dist/utils","strict":true,"target":1,"tsBuildInfoFile":"./utils.tsbuildinfo"},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,3,2,5,4,6,7],"latestChangedDtsFile":"../dist/utils/text.d.ts"},"version":"4.8.4"}
@@ -0,0 +1 @@
1
+ {"program":{"fileNames":["../../../../node_modules/typescript/lib/lib.d.ts","../../../../node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../../node_modules/typescript/lib/lib.scripthost.d.ts","./src/index.ts"],"fileInfos":["2dc8c927c9c162a773c6bb3cdc4f3286c23f10eedc67414028f9cb5951610f60",{"version":"f20c05dbfe50a208301d2a1da37b9931bce0466eb5a1f4fe240971b4ecc82b67","affectsGlobalScope":true},{"version":"9b087de7268e4efc5f215347a62656663933d63c0b1d7b624913240367b999ea","affectsGlobalScope":true},{"version":"7fac8cb5fc820bc2a59ae11ef1c5b38d3832c6d0dfaec5acdb5569137d09a481","affectsGlobalScope":true},{"version":"097a57355ded99c68e6df1b738990448e0bf170e606707df5a7c0481ff2427cd","affectsGlobalScope":true},"39441a0f0f37ba8f1a5ef3bf717953d53469cfd7a8450a8a2221959a67905497"],"options":{"module":1,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./dist","strict":true,"target":1,"tsBuildInfoFile":"./do-not-delete.tsbuildinfo"},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,3,2,5,4,6]},"version":"4.8.4"}
@@ -0,0 +1,3 @@
1
+ export function add(a: number, b: number) {
2
+ return a + b
3
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "strict": true,
4
+ "target": "es5",
5
+ "moduleResolution": "node",
6
+ "module": "commonjs",
7
+ "outDir": "dist",
8
+
9
+ // These settings should be overridden by the typescript checker
10
+ "noUnusedLocals": true,
11
+ "noUnusedParameters": true,
12
+
13
+ "types": [],
14
+ "incremental": true,
15
+ "tsBuildInfoFile": "do-not-delete.tsbuildinfo"
16
+ }
17
+ }
@@ -0,0 +1,9 @@
1
+ export class Counter {
2
+ constructor(private currentNumber: number) {}
3
+ public increment(numberToIncrementBy = 1): number {
4
+ return (this.currentNumber += numberToIncrementBy)
5
+ }
6
+ get getCurrentNumber(): number {
7
+ return this.currentNumber
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ export class Counter {
2
+ constructor(private currentNumber: number) {}
3
+ public increment(numberToIncrementBy = 1) {
4
+ return (this.currentNumber += numberToIncrementBy)
5
+ }
6
+ get getCurrentNumber(): number {
7
+ return this.currentNumber
8
+ }
9
+ }
@@ -0,0 +1,7 @@
1
+ import { Counter } from './counter'
2
+ import { TodoList } from './todo'
3
+
4
+ const counter = new Counter(1)
5
+ const todoList = new TodoList()
6
+ todoList.createTodoItem('test', 'test description')
7
+ const newCount: number = counter.increment()
@@ -0,0 +1,11 @@
1
+ import { TodoList } from './todo.js'
2
+
3
+ const list = new TodoList()
4
+ const n: number = list.createTodoItem('Mow lawn', 'Mow moving forward.')
5
+ console.log(n)
6
+
7
+ function addTodo(name = 'test', description = 'test') {
8
+ list.createTodoItem(name, description)
9
+ }
10
+
11
+ addTodo()
@@ -0,0 +1,22 @@
1
+ export interface ITodo {
2
+ name: string
3
+ description: string
4
+ completed: boolean
5
+ }
6
+
7
+ class Todo implements ITodo {
8
+ constructor(public name: string, public description: string, public completed: boolean) {}
9
+ }
10
+
11
+ export class TodoList {
12
+ public static allTodos: Todo[] = []
13
+ createTodoItem(name: string, description: string) {
14
+ let newItem = new Todo(name, description, false)
15
+ let totalCount: number = TodoList.allTodos.push(newItem)
16
+ return totalCount
17
+ }
18
+
19
+ allTodoItems(): ITodo[] {
20
+ return TodoList.allTodos
21
+ }
22
+ }
@@ -0,0 +1 @@
1
+ const foo = 'bar'
@@ -0,0 +1,11 @@
1
+ import { TodoList } from './todo.js'
2
+
3
+ const list = new TodoList()
4
+ const n: number = list.createTodoItem('Mow lawn', 'Mow moving forward.')
5
+ console.log(n)
6
+
7
+ function addTodo(name = 'test', description = 'test') {
8
+ list.createTodoItem(name, description)
9
+ }
10
+
11
+ addTodo()