<commit_before>// TODO: Why does the compiler not complain when Marionette is missing?
import * as Marionette from "backbone.marionette"
import TodoCollection from "./TodoCollection"
import TodoModel from "./TodoModel"
import TodoView from "./TodoView"

// Add childViewContainer?:string; to CollectionViewOptions in marionette/index.d.ts.

interface TodosViewOptions extends Marionette.CollectionViewOptions<TodoModel> {
  collection: TodoCollection
}

export default class TodosView extends Marionette.CompositeView<TodoModel, TodoView> {
  constructor(options: TodosViewOptions) {
    super({
      childViewContainer: ".js-child-view-container"
    })

    this.collection = options.collection
  }

  childView = TodoView

  collection: TodoCollection

  template = require("./TodosView.ejs")
}<commit_msg>Introduce setDefaultOptions to extend the options<commit_after>// TODO: Why does the compiler not complain when Marionette is missing?
import * as Marionette from "backbone.marionette"
import TodoCollection from "./TodoCollection"
import TodoModel from "./TodoModel"
import TodoView from "./TodoView"

// Add this to marionette/index.d.ts.
// interface CompositeViewOptions<TModel extends Backbone.Model> extends CollectionViewOptions<TModel> {
//     childView?: string,
//     collection?: Backbone.Collection<TModel>,
//     template?: any
// }

interface TodosViewOptions extends Marionette.CompositeViewOptions<TodoModel> {
  collection: TodoCollection
}

export default class TodosView extends Marionette.CompositeView<TodoModel, TodoView> {
  constructor(options: TodosViewOptions) {
    super(TodosView.setDefaultOptions(options))
  }

  childView = TodoView

  collection: TodoCollection

  template = require("./TodosView.ejs")

  private static setDefaultOptions(options: TodosViewOptions): TodosViewOptions {
    options.childViewContainer = ".js-child-view-container"
    return options
  }
}
{'fraction_non_alphanumeric': 0.09190600522193211, 'fraction_numerical': 0.0, 'mean_word_length': 4.968847352024922, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7237474', 'n_tokens_mistral': 557, 'n_tokens_neox': 539, 'n_words': 142}