3
import "introcs";
export function main(): void {
print ("Intro");
print ("a");
print ("b");
promptString("What would like to do?", forkMain);
}
export function forkMain(choice: string): void {
clear();
if ("a") {
storyA();
} else if ("b") {
storyB();
} else {
main();
}
}
export function storyA(): void {
print ("result");
print ("1");
print ("2");
promptNumber("What would like to do?", forkA);
}
export function forkA(choice: number): void {
clear();
if (1) {
storyC();
} else if (2) {
storyD();
} else {
storyA();
}
}
export function storyB(): void {
print ("result");
print ("3");
print ("4");
promptString("What would like to do?", forkB);
}
export function forkB(choice: number): void {
clear();
if (1) {
storyE();
} else if (2) {
storyF();
} else {
storyB();
}
}
export function storyC(): void {
print ("the end story c");
}
export function storyD(): void {
print ("the end story d");
}
export function storyE(): void {
print ("the end story e");
}
export function storyF(): void {
print ("the end story f");
}
main();
안녕하세요 여러분, 위의 코드는 내가 CYOA에서 작업하는 초기 단계에 있지만 일단 인쇄 단계에서 문제가 발생하면 forkB 단계가됩니다 코드의 다음 오류가 나타납니다.VSC @TypeScript 관찰 가능한 오류
"severity: 'Error'
message: 'Argument of type '(choice: number) => void' is not assignable to parameter of type '(value: string) => void'.
Types of parameters 'choice' and 'value' are incompatible.
Type 'string' is not assignable to type 'number'.'"
제가 여기서 잘못하고있는 어떤 단서가 있습니까? 나는 내 구문을 생각하지만, 확실 I'mm