小编Car*_*ada的帖子

tsconfig.json 不关心allowJs

我试图在我的 Angular 5 应用程序中使用一个 .js 文件,该文件仅以 JavaScript 语言提供,所以我在 TypeScript 中找不到替代方案。

问题是我已"allowJs": true在 tsconfig.json 中添加了 ,但错误仍然存​​在。我的 tsconfig.json 是:

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "allowJs": true,
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

错误是:

'<path>/file.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
Run Code Online (Sandbox Code Playgroud)

怎么了?

javascript tsconfig angular

11
推荐指数
2
解决办法
3万
查看次数

Android Recyclerview预加载视图

我想知道当用户滚动得更快时,我怎么能避免回收者视图中的小白色"闪烁".
当然可以通过在可见屏幕之外预加载更多视图来避免闪烁

我找不到任何可以做到的事情,虽然这一定是一个非常常见的任务?

我在博客上试过这段代码:

public class PreCachingLayoutManager extends LinearLayoutManager {
    private static final int DEFAULT_EXTRA_LAYOUT_SPACE = 600;
    private int extraLayoutSpace = -1;
    private Context context;

    public PreCachingLayoutManager(Context context) {
        super(context);
        this.context = context;
    }

    public PreCachingLayoutManager(Context context, int extraLayoutSpace) {
        super(context);
        this.context = context;
        this.extraLayoutSpace = extraLayoutSpace;
    }

    public PreCachingLayoutManager(Context context, int orientation, boolean reverseLayout) {
        super(context, orientation, reverseLayout);
        this.context = context;
    }

    public void setExtraLayoutSpace(int extraLayoutSpace) {
        this.extraLayoutSpace = extraLayoutSpace;
    }

    @Override
    protected int getExtraLayoutSpace(RecyclerView.State state) {
        if (extraLayoutSpace …
Run Code Online (Sandbox Code Playgroud)

android preload android-recyclerview

5
推荐指数
1
解决办法
7000
查看次数

警告:与项目':app'中的依赖项'junit:junit'冲突.app(4.11)和test app(4.12)的已解决版本

我正在尝试解决两个错误:

  1. 无法解析符号'test'
  2. 无法解析符号'AndroidJUnit4'

在我的Android Studio项目中运行集成测试.为了解决这个问题,我已经看到了一些答案,我的build.gradle看起来像:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '25.0.0'

    defaultConfig {
        applicationId "com.ps.comunio.comuniops"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
        }
    }
    compileOptions.with {
        sourceCompatibility = JavaVersion.VERSION_1_7
        targetCompatibility = JavaVersion.VERSION_1_7
    }
    lintOptions {
        abortOnError false
    }

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.11'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.loopj.android:android-async-http:1.4.9'
    compile 'info.cukes:cucumber-java:1.2.0'
    compile 'info.cukes:cucumber-junit:1.2.0'
    androidTestCompile …
Run Code Online (Sandbox Code Playgroud)

testing junit dependencies android android-gradle-plugin

4
推荐指数
2
解决办法
1635
查看次数

Apache 将时间戳记记录到日期打字稿

"18/May/2011:12:40:18 -0700"从 Apache 日志中获取此时间戳,并且想将其转换为日期类型。我想从时间戳中提取该月的日期、月份、年份和时间。

当我尝试根据之前显示的数据创建新日期时,我收到Invalid data来自 TS 编译器的错误消息。我认为这-0700就是问题所在,所以我请求解决方案。

apache logging date typescript

2
推荐指数
1
解决办法
576
查看次数

无法将预期类型"[Char]"与实际类型"a"匹配

我以前从未在Stackoverflow中看到过这个具体问题,而其他问题对我没有帮助(我在打开此问题之前已经尝试过).

当我尝试以这种方式打印二进制树时:

data BinTree a = ET | Branch (BinTree a) a (BinTree a) deriving Show

ejC:: BinTree a -> String
ejC ET = ""
ejC (Branch x y z) = (ejC x) ++ "|-" ++ y ++ "-|" ++ (ejC z)
Run Code Online (Sandbox Code Playgroud)

该模块给出了这个错误:

Couldn't match expected type `[Char]' with actual type `a'
`a' is a rigid type variable bound by
the type signature for ejC :: BinTree a -> String at Types2.hs:24:7
Relevant bindings include
z :: BinTree a (bound …
Run Code Online (Sandbox Code Playgroud)

printing tree haskell

1
推荐指数
1
解决办法
405
查看次数