0
인터페이스가있는 특정 구성 변수가 있습니다. 내가 그것을 가져오고 난 오류 " 'Server 구성에'를 이름을 찾을 수 없습니다"를 얻을이 구성 여기형식 정보가 포함 된 typescript 변수 내보내기
// I import my variable
import config = require("./config");
// I create a function that will consume a variable that complies with that interface
function initializeDatabase(config: ServerConfiguration) {
//do stuff
}
을 소모하도록 설계되어 함수를 만들려고 그 이후
//I declare my interface
interface ServerConfiguration {
development: {
db: {
url: string,
user: string,
password: string,
},
webServer: {
port: number;
rootPath: string;
}
};
}
//I declare a variable that uses that interface
const config: ServerConfiguration = {
development: {
db: {
url: "someUrl",
user: "myuser",
password: "mypassword",
},
webServer: {
port: process.env.PORT || 9001,
rootPath: rootPath,
},
},
};
// I export my variable
export {config};
, 무슨 일이에요?
당신은 내 IDE를 구축 내 github의 문제를 해결, 내 타이프 라이터 매뉴얼 및 지금 답을 쓰기 가져 내 stackoverflow 질문. 당신은 어떤 종류의 인터넷 신 또는 무언가인가? 어쩌면 나는 당신의 그림을 인쇄하고 몇몇 초의 옆에 둬야한다. 어쨌든, 감사합니다 !!! 너는 대단해 !! –
사람을 돕고 TypeScript를 좋아하는 사람. 당신 같은 사람들은 모든 가치가 있습니다. – basarat