Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit50b2719

Browse files
committed
do something nice for typescript
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parentcfaa48b commit50b2719

20 files changed

+47
-32
lines changed

‎src/actions/onActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import logger from '../services/logger'
99

1010
interfaceSetupActions{
1111
actions:TT.StepActions
12-
send:(action:T.Action)=>void// send messages to client
12+
send:T.Send
1313
dir?:string
1414
}
1515

‎src/actions/onErrorPage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as T from 'typings'
22
import{readFile}from'../services/node'
33
importloggerfrom'../services/logger'
44

5-
constonErrorPage=async(action:T.Action):void=>{
5+
constonErrorPage=async(action:T.Action):Promise<void>=>{
66
// Error middleware
77
if(action?.payload?.error?.type){
88
// load error markdown message

‎src/actions/onOpenLogs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import*asTfrom'typings'
22
import{showOutput}from'../services/testRunner/output'
33

4-
exportconstonOpenLogs=async(action:T.Action):void=>{
4+
exportconstonOpenLogs=async(action:T.Action):Promise<void>=>{
55
constchannel=action.payload.channel
66
awaitshowOutput(channel)
77
}

‎src/actions/onRunReset.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type ResetAction = {
1111
}
1212

1313
// reset to the start of the last test
14-
constonRunReset=async(action:ResetAction,context:Context):void=>{
14+
constonRunReset=async(action:ResetAction,context:Context):Promise<void>=>{
1515
// reset to timeline
1616
consttutorial:TT.Tutorial|null=context.tutorial.get()
1717
constposition:T.Position=action.position ?action.position :context.position.get()

‎src/actions/onStartup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const onStartup = async (
1111
context:Context,
1212
workspaceState:vscode.Memento,
1313
send:(action:T.Action)=>Promise<void>,
14-
):void=>{
14+
):Promise<void>=>{
1515
try{
1616
// check if a workspace is open, otherwise nothing works
1717
constnoActiveWorkspace=!WORKSPACE_ROOT.length

‎src/actions/onTutorialConfigContinue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Context from '../services/context/context'
55
importtutorialConfigfrom'./utils/tutorialConfig'
66
import{COMMANDS}from'../commands'
77

8-
constonTutorialConfigContinue=async(action:T.Action,context:Context,send:T.Send):void=>{
8+
constonTutorialConfigContinue=async(action:T.Action,context:Context,send:T.Send):Promise<void>=>{
99
try{
1010
consttutorialContinue:TT.Tutorial|null=context.tutorial.get()
1111
if(!tutorialContinue){

‎src/actions/onTutorialConfigNew.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { version, compareVersions } from '../services/dependencies'
88
importContextfrom'../services/context/context'
99
importtutorialConfigfrom'./utils/tutorialConfig'
1010

11-
constonTutorialConfigNew=async(action:T.Action,context:Context,send:T.Send):void=>{
11+
constonTutorialConfigNew=async(action:T.Action,context:Context,send:T.Send):Promise<void>=>{
1212
try{
1313
constdata:TT.Tutorial=action.payload.tutorial
1414

‎src/actions/onValidateSetup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import*asTfrom'typings'
12
import*asEfrom'typings/error'
23
import{version}from'../services/dependencies'
34
import{checkWorkspaceEmpty}from'../services/workspace'
45

5-
constonValidateSetup=async(send:T.Send):void=>{
6+
constonValidateSetup=async(send:T.Send):Promise<void>=>{
67
try{
78
// check workspace is selected
89
constisEmptyWorkspace=awaitcheckWorkspaceEmpty()

‎src/actions/utils/loadWatchers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const disposeWatcher = (watcher: string) => {
1414
deletewatcherObject[watcher]
1515
}
1616

17-
constloadWatchers=(watchers:string[])=>{
17+
constloadWatchers=(watchers:string[]):void=>{
1818
if(!watchers.length){
1919
// remove all watchers
2020
for(constwatcherofObject.keys(watcherObject)){

‎src/actions/utils/openFiles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { join } from 'path'
22
import*asvscodefrom'vscode'
33
import{COMMANDS}from'../../commands'
44

5-
constopenFiles=async(files:string[])=>{
5+
constopenFiles=async(files:string[]):Promise<void>=>{
66
if(!files.length){
77
return
88
}

‎src/actions/utils/runCommands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface RunCommands {
77
dir?:string
88
}
99

10-
construnCommands=async({ commands, send, dir}:RunCommands)=>{
10+
construnCommands=async({ commands, send, dir}:RunCommands):Promise<void>=>{
1111
if(!commands.length){
1212
return
1313
}

‎src/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import{getWorkspaceRoot}from'./services/workspace'
22
import*asosfrom'os'
33

4-
exportconstVERSION=require('../package.json').version
4+
exportconstVERSION=require('../package.json').version// eslint-disable-line
55

66
exportconstEXTENSION_ID='coderoad'
77

‎src/services/context/state/Position.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Position {
1616
constructor(){
1717
this.value=defaultValue
1818
}
19-
setTutorial(workspaceState:vscode.Memento,tutorial:TT.Tutorial){
19+
setTutorial(workspaceState:vscode.Memento,tutorial:TT.Tutorial):void{
2020
this.storage=newStorage<T.Position>({
2121
key:`coderoad:position:${tutorial.id}:${tutorial.version}`,
2222
storage:workspaceState,
@@ -27,7 +27,7 @@ class Position {
2727
// set value from storage
2828
this.setTutorial(workspaceState,tutorial)
2929
// find first level & step id
30-
letinitLevel=tutorial.levels.length ?tutorial.levels[0] :null
30+
constinitLevel=tutorial.levels.length ?tutorial.levels[0] :null
3131
returnthis.set({
3232
levelId:initLevel?.id||'',
3333
stepId:initLevel?.steps.length ?initLevel.steps[0].id :null,
@@ -36,18 +36,18 @@ class Position {
3636
}
3737
asynccontinuePosition(workspaceState:vscode.Memento,tutorial:TT.Tutorial):Promise<T.Position>{
3838
this.setTutorial(workspaceState,tutorial)
39-
letposition:T.Position=(awaitthis.storage?.get())||defaultValue
39+
constposition:T.Position=(awaitthis.storage?.get())||defaultValue
4040
returnthis.set(position)
4141
}
42-
publicget=()=>{
42+
publicget=():T.Position=>{
4343
returnthis.value
4444
}
45-
publicset=(value:T.Position)=>{
45+
publicset=(value:T.Position):T.Position=>{
4646
this.value=value
4747
this.storage?.set(value)
4848
returnthis.value
4949
}
50-
publicreset=()=>{
50+
publicreset=():T.Position=>{
5151
returnthis.set(defaultValue)
5252
}
5353
}

‎src/services/context/state/Tutorial.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ class Tutorial {
1717
this.value=value
1818
})
1919
}
20-
publicget=()=>{
20+
publicget=():TT.Tutorial|null=>{
2121
returnthis.value
2222
}
23-
publicset=(value:TT.Tutorial|null)=>{
23+
publicset=(value:TT.Tutorial|null):void=>{
2424
this.value=value
2525
this.storage.set(value)
2626
}
27-
publicreset=()=>{
27+
publicreset=():void=>{
2828
this.set(null)
2929
}
3030
}

‎src/services/logger/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import{LOG}from'../../environment'
22

3-
exporttypeLog=string|number|object|null|undefined
3+
exporttypeLog=string|number|object|null|undefined// eslint-disable-line
44

55
constlogger=(...messages:Log[]):void=>{
66
if(!LOG){

‎src/services/reset/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ interface Input {
55
branch:string
66
}
77

8-
constignoreError=()=>{}
8+
constignoreError=()=>{
9+
/* */
10+
}
911

1012
// note: attempted to do this as a bash script
1113
// but requires the bash script has git permissions

‎src/services/reset/lastHash.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import*asTTfrom'../../../typings/tutorial'
22
import*asTfrom'../../../typings'
33

4-
constgetLastCommitHash=(position:T.Position,tutorial:TT.Tutorial|null)=>{
4+
constgetLastCommitHash=(position:T.Position,tutorial:TT.Tutorial|null):string=>{
55
if(!tutorial){
66
thrownewError('No tutorial found')
77
}

‎src/services/testRunner/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ interface TestRunnerParams {
2626
onSuccess?:()=>void
2727
}
2828

29-
constcreateTestRunner=(data:TT.Tutorial,callbacks:Callbacks)=>{
29+
constcreateTestRunner=(data:TT.Tutorial,callbacks:Callbacks):((params:any)=>Promise<void>)=>{
3030
consttestRunnerConfig=data.config.testRunner
3131
consttestRunnerFilterArg=testRunnerConfig.args?.filter
32-
returnasync({ position, onSuccess}:TestRunnerParams):Promise<void>=>{
32+
returnasync({ position, onSuccess}:TestRunnerParams):Promise<any>=>{
3333
conststartTime=throttle()
3434
// throttle time early
3535
if(!startTime){

‎src/services/testRunner/output.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import*asvscodefrom'vscode'
22

3-
constchannels:{key:string;value:vscode.OutputChannel}|{}={}
3+
constchannels:
4+
|{key:string;value:vscode.OutputChannel}
5+
|{
6+
/* */
7+
}={}
48

59
constgetOutputChannel=(name:string):vscode.OutputChannel=>{
610
if(!channels[name]){
@@ -15,18 +19,18 @@ interface ChannelOutput {
1519
show?:boolean
1620
}
1721

18-
exportconstaddOutput=(params:ChannelOutput)=>{
22+
exportconstaddOutput=(params:ChannelOutput):void=>{
1923
constchannel=getOutputChannel(params.channel)
2024
channel.clear()
2125
channel.append(params.text)
2226
}
2327

24-
exportconstshowOutput=(channelName:string)=>{
28+
exportconstshowOutput=(channelName:string):void=>{
2529
constchannel=getOutputChannel(channelName)
2630
channel.show()
2731
}
2832

29-
exportconstclearOutput=(channelName:string)=>{
33+
exportconstclearOutput=(channelName:string):void=>{
3034
constchannel=getOutputChannel(channelName)
3135
channel.clear()
3236
channel.hide()

‎src/services/webview/index.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import*asTfrom'typings'
12
import*aspathfrom'path'
23
import{Action}from'typings'
34
import*asvscodefrom'vscode'
@@ -9,9 +10,16 @@ interface ReactWebViewProps {
910
workspaceState:vscode.Memento
1011
}
1112

12-
letstate={loaded:false}
13+
interfaceOutput{
14+
state:{loaded:boolean}
15+
createOrShow():void
16+
send:T.Send
17+
receive:T.Send
18+
}
19+
20+
conststate={loaded:false}
1321

14-
constcreateReactWebView=({ extensionPath, workspaceState}:ReactWebViewProps)=>{
22+
constcreateReactWebView=({ extensionPath, workspaceState}:ReactWebViewProps):Output=>{
1523
// TODO add disposables
1624
constdisposables:vscode.Disposable[]=[]
1725

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp