common: add tsconfig

This commit is contained in:
Koushik Dutta
2022-03-02 12:06:23 -08:00
parent 34cc56073f
commit 75fefbb2cf
2 changed files with 22 additions and 5 deletions

View File

@@ -56,7 +56,7 @@ export function createRtspParser(): RtspStreamParser {
}
function parseHeaders(headers: string[]): Headers {
const ret = {};
const ret: any = {};
for (const header of headers.slice(1)) {
const index = header.indexOf(':');
let value = '';
@@ -148,7 +148,7 @@ export class RtspClient extends RtspBase {
}
async setup(channel: number, path?: string) {
const headers = {
const headers: any = {
Transport: `RTP/AVP/TCP;unicast;interleaved=${channel}-${channel + 1}`,
};
if (this.session)
@@ -160,7 +160,7 @@ export class RtspClient extends RtspBase {
}
async play() {
const headers = {
const headers: any = {
Range: 'npt=0.000-',
};
if (this.session)
@@ -353,12 +353,13 @@ export class RtspServer {
let [method, url] = headers[0].split(' ', 2);
method = method.toLowerCase();
const requestHeaders = parseHeaders(headers);
if (!this[method]) {
const thisAny = this as any;
if (!thisAny[method]) {
this.respond(400, 'Bad Request', requestHeaders, {});
return;
}
await this[method](url, requestHeaders);
await thisAny[method](url, requestHeaders);
return method !== 'play' && method !== 'record' && method !== 'teardown';
}

16
common/tsconfig.json Normal file
View File

@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "esnext",
"noImplicitAny": true,
"outDir": "./dist",
"esModuleInterop": true,
// skip error: Interface 'WebGL2RenderingContext' incorrectly extends interface 'WebGL2RenderingContextBase'.
// https://github.com/tensorflow/tfjs/issues/4201
"skipLibCheck": true,
"sourceMap": true
},
"include": [
"src/**/*"
],
}